summary refs log tree commit diff
path: root/pkgs/os-specific/linux/libcap/progs.nix
blob: e3871f15f885ce1646933cdd76db069c82b7c2c8 (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
{stdenv, libcap}:

assert stdenv.isLinux;

stdenv.mkDerivation rec {
  name = "libcap-progs-${libcap.version}";

  inherit (libcap) src makeFlags;

  buildInputs = [ libcap ];

  prePatch = ''
    # use relative bash path
    substituteInPlace progs/capsh.c --replace "/bin/bash" "bash"

    # ensure capsh can find bash in $PATH
    substituteInPlace progs/capsh.c --replace execve execvpe
  '';

  preConfigure = "cd progs";

  installFlags = "RAISE_SETFCAP=no";

  postInstall = ''
    mkdir -p "$out/share/doc/${name}"
    cp ../License "$out/share/doc/${name}/"
  '';
}