about summary refs log tree commit diff
path: root/pkgs/tools/nix/info/default.nix
blob: 7b29f9c43c9a4e3b6045226c27024d5c76df0bba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ stdenv, lib, coreutils, findutils, gnugrep, darwin, bash
# Avoid having GHC in the build-time closure of all NixOS configurations
, doCheck ? false, shellcheck
}:

stdenv.mkDerivation {
  name = "nix-info";
  src = ./info.sh;

  path = lib.makeBinPath ([
    coreutils findutils gnugrep
  ] ++ (lib.optionals stdenv.hostPlatform.isDarwin [ darwin.DarwinTools ]));
  is_darwin = if stdenv.hostPlatform.isDarwin then "yes" else "no";

  sandboxtest = ./sandbox.nix;
  relaxedsandboxtest = ./relaxedsandbox.nix;
  multiusertest = ./multiuser.nix;

  unpackCmd = ''
    mkdir nix-info
    cp $src ./nix-info/nix-info
  '';

  buildPhase  = ''
    substituteAllInPlace ./nix-info
  '';

  inherit doCheck;
  strictDeps = true;
  nativeCheckInputs = [ shellcheck ];
  buildInputs = [ bash ];

  checkPhase = ''
    shellcheck ./nix-info
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp ./nix-info $out/bin/nix-info
  '';

  preferLocalBuild = true;

  meta = {
    platforms = lib.platforms.all;
  };
}