Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1# The program `nuke-refs' created by this derivation replaces all
2# references to the Nix store in the specified files by a non-existent
3# 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 perl,
10 signingUtils,
11 shell ? stdenvNoCC.shell,
12}:
13
14let
15 stdenv = stdenvNoCC;
16
17 darwinCodeSign = stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64;
18in
19
20stdenvNoCC.mkDerivation {
21 name = "nuke-references";
22
23 strictDeps = true;
24 enableParallelBuilding = true;
25 dontUnpack = true;
26 dontConfigure = true;
27 dontBuild = true;
28
29 installPhase = ''
30 mkdir -p $out/bin
31 substituteAll ${./nuke-refs.sh} $out/bin/nuke-refs
32 chmod a+x $out/bin/nuke-refs
33 '';
34
35 postFixup = lib.optionalString darwinCodeSign ''
36 mkdir -p $out/nix-support
37 substituteAll ${./darwin-sign-fixup.sh} $out/nix-support/setup-hooks.sh
38 '';
39
40 # FIXME: get rid of perl dependency.
41 env = {
42 inherit perl;
43 inherit (builtins) storeDir;
44 shell = lib.getBin shell + (shell.shellPath or "");
45 signingUtils = lib.optionalString darwinCodeSign signingUtils;
46 };
47
48 meta.mainProgram = "nuke-refs";
49}