diff --git a/pkgs/build-support/nuke-references/builder.sh b/pkgs/build-support/nuke-references/builder.sh new file mode 100644 index 000000000000..867262c516b6 --- /dev/null +++ b/pkgs/build-support/nuke-references/builder.sh @@ -0,0 +1,12 @@ +source $stdenv/setup + +ensureDir $out/bin +cat > $out/bin/nuke-refs < \$i.tmp + if test -x \$i; then chmod +x \$i.tmp; fi + mv \$i.tmp \$i +done +EOF +chmod +x $out/bin/nuke-refs diff --git a/pkgs/build-support/nuke-references/default.nix b/pkgs/build-support/nuke-references/default.nix new file mode 100644 index 000000000000..d672184553f6 --- /dev/null +++ b/pkgs/build-support/nuke-references/default.nix @@ -0,0 +1,11 @@ +# The program `nuke-refs' created by this derivation replaces all +# references to the Nix store in the specified files by a non-existant +# path (/nix/store/eeee...). This is useful for getting rid of +# dependencies that you know are not actually needed at runtime. + +{stdenv}: + +stdenv.mkDerivation { + name = "nuke-references"; + builder = ./builder.sh; +} \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 51a07641b11b..d8e5023207d0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -192,6 +192,10 @@ rec { inherit stdenv; }; + nukeReferences = import ../build-support/nuke-references/default.nix { + inherit stdenv; + }; + ### TOOLS