nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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
13let
14 stdenv = stdenvNoCC;
15
16 darwinCodeSign = stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64;
17in
18
19stdenv.mkDerivation {
20 name = "remove-references-to";
21
22 dontUnpack = true;
23 dontConfigure = true;
24 dontBuild = true;
25
26 installPhase = ''
27 mkdir -p $out/bin
28 substituteAll ${./remove-references-to.sh} $out/bin/remove-references-to
29 chmod a+x $out/bin/remove-references-to
30 '';
31
32 postFixup = lib.optionalString darwinCodeSign ''
33 mkdir -p $out/nix-support
34 substituteAll ${./darwin-sign-fixup.sh} $out/nix-support/setup-hooks.sh
35 '';
36
37 env = {
38 inherit (builtins) storeDir;
39 shell = lib.getBin shell + (shell.shellPath or "");
40 }
41 // lib.optionalAttrs darwinCodeSign { inherit signingUtils; };
42
43 meta.mainProgram = "remove-references-to";
44}