1{
2 stdenv,
3 lib,
4 coreutils,
5 findutils,
6 gnugrep,
7 darwin,
8 bash,
9 # Avoid having GHC in the build-time closure of all NixOS configurations
10 doCheck ? false,
11 shellcheck,
12}:
13
14stdenv.mkDerivation {
15 name = "nix-info";
16 src = ./info.sh;
17
18 path = lib.makeBinPath (
19 [
20 coreutils
21 findutils
22 gnugrep
23 ]
24 ++ (lib.optionals stdenv.hostPlatform.isDarwin [ darwin.DarwinTools ])
25 );
26 is_darwin = if stdenv.hostPlatform.isDarwin then "yes" else "no";
27
28 sandboxtest = ./sandbox.nix;
29 relaxedsandboxtest = ./relaxedsandbox.nix;
30 multiusertest = ./multiuser.nix;
31
32 unpackCmd = ''
33 mkdir nix-info
34 cp $src ./nix-info/nix-info
35 '';
36
37 buildPhase = ''
38 substituteAllInPlace ./nix-info
39 '';
40
41 inherit doCheck;
42 strictDeps = true;
43 nativeCheckInputs = [ shellcheck ];
44 buildInputs = [ bash ];
45
46 checkPhase = ''
47 shellcheck ./nix-info
48 '';
49
50 installPhase = ''
51 mkdir -p $out/bin
52 cp ./nix-info $out/bin/nix-info
53 '';
54
55 preferLocalBuild = true;
56
57 meta = {
58 platforms = lib.platforms.all;
59 };
60}