X-Git-Url: http://git.scottworley.com/nixos-qemu-vm-isolation/blobdiff_plain/1b39c55ce550354b408a3e017f2fec88b6f20a1b..HEAD:/overlays/squashfs-labels/default.nix diff --git a/overlays/squashfs-labels/default.nix b/overlays/squashfs-labels/default.nix index 8a482d3..a8ef856 100644 --- a/overlays/squashfs-labels/default.nix +++ b/overlays/squashfs-labels/default.nix @@ -1,12 +1,18 @@ # We patch in support for squashfs labels because # https://github.com/NixOS/nixpkgs/pull/236656 requires filesystems to have labels and # https://github.com/plougher/squashfs-tools/issues/59 squashfs doesn't support labels -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; }