python312Packages.vdf: avoid using pname for src.repo
[NixPkgs.git] / pkgs / os-specific / linux / selinux-sandbox / default.nix
blobcbddfc3ec50a3dc7e2d35a5471871fa91a96f55c
1 { lib, stdenv, fetchurl, bash, coreutils, python3
2 , libcap_ng, policycoreutils, selinux-python, dbus
3 , xorgserver, openbox, xmodmap }:
5 # this is python3 only as it depends on selinux-python
7 with python3.pkgs;
9 stdenv.mkDerivation rec {
10   pname = "selinux-sandbox";
11   version = "3.3";
12   inherit (policycoreutils) se_url;
14   src = fetchurl {
15     url = "${se_url}/${version}/selinux-sandbox-${version}.tar.gz";
16     sha256 = "0rw8pxfqhl6ww4w31fbf4hi3zilh1n3b1rfjm7ra76mm78wfyylj";
17   };
19   nativeBuildInputs = [ wrapPython ];
20   buildInputs = [ bash coreutils libcap_ng policycoreutils python3 xorgserver openbox xmodmap dbus ];
21   propagatedBuildInputs = [ pygobject3 selinux-python ];
23   postPatch = ''
24     # Fix setuid install
25     substituteInPlace Makefile --replace "-m 4755" "-m 755"
26     substituteInPlace sandboxX.sh \
27       --replace "#!/bin/sh" "#!${bash}/bin/sh" \
28       --replace "/usr/share/sandbox/start" "${placeholder "out"}/share/sandbox/start" \
29       --replace "/usr/bin/cut" "${coreutils}/bin/cut" \
30       --replace "/usr/bin/Xephyr" "${xorgserver}/bin/Xepyhr" \
31       --replace "secon" "${policycoreutils}/bin/secon"
32     substituteInPlace sandbox \
33       --replace "/usr/sbin/seunshare" "$out/bin/seunshare" \
34       --replace "/usr/share/sandbox" "$out/share/sandbox" \
35       --replace "/usr/share/locale" "${policycoreutils}/share/locale" \
36       --replace "/usr/bin/openbox" "${openbox}/bin/openbox" \
37       --replace "#!/bin/sh" "#!${bash}/bin/sh" \
38       --replace "dbus-" "${dbus}/bin/dbus-" \
39       --replace "/usr/bin/xmodmap" "${xmodmap}/bin/xmodmap" \
40       --replace "/usr/bin/shred" "${coreutils}/bin/shred" \
41       --replace "/usr/bin/test" "${coreutils}/bin/test" \
42   '';
44   makeFlags = [
45     "PREFIX=$(out)"
46     "SYSCONFDIR=$(out)/etc/sysconfig"
47   ];
49   postFixup = ''
50     wrapPythonPrograms
51   '';
53   meta = with lib; {
54     description = "SELinux sandbox utility";
55     license = licenses.gpl2Only;
56     homepage = "https://selinuxproject.org";
57     platforms = platforms.linux;
58     maintainers = with lib.maintainers; [ RossComputerGuy ];
59   };