1# The program `remove-references-to' created by this derivation replaces all
2# references to the given Nix store paths in the specified files by a
3# non-existent path (/nix/store/eeee...). This is useful for getting rid of
4# dependencies that you know are not actually needed at runtime.
5
6{
7 lib,
8 stdenvNoCC,
9 signingUtils,
10 shell ? stdenvNoCC.shell,
11}:
12
13stdenvNoCC.mkDerivation {
14 name = "remove-references-to";
15
16 dontUnpack = true;
17 dontConfigure = true;
18 dontBuild = true;
19
20 installPhase = ''
21 mkdir -p $out/bin
22 substituteAll ${./remove-references-to.sh} $out/bin/remove-references-to
23 chmod a+x $out/bin/remove-references-to
24 '';
25
26 env = {
27 inherit (builtins) storeDir;
28 shell = lib.getBin shell + (shell.shellPath or "");
29 signingUtils = lib.optionalString (
30 stdenvNoCC.targetPlatform.isDarwin && stdenvNoCC.targetPlatform.isAarch64
31 ) signingUtils;
32 };
33
34 meta.mainProgram = "remove-references-to";
35}