-final: prev: {
- squashfsTools = prev.squashfsTools.overrideAttrs (old: {
- patches = (old.patches or [ ]) ++ [ ./squashfs-tools-label.patch ];
- });
-
- util-linux = prev.util-linux.overrideAttrs (old: {
- patches = (old.patches or [ ]) ++ [ ./util-linux-squashfs-label.patch ];
- });
+final: prev:
+let
+ idempontenlyAddPatch =
+ pkg: patch:
+ if builtins.elem patch (pkg.drvAttrs.patches or [ ]) then
+ pkg
+ else
+ pkg.overrideAttrs (old: {
+ patches = (old.patches or [ ]) ++ [ patch ];
+ });
+in
+{
+ squashfsTools = idempontenlyAddPatch prev.squashfsTools ./squashfs-tools-label.patch;
+ util-linux = idempontenlyAddPatch prev.util-linux ./util-linux-squashfs-label.patch;