nixpkgs/pkgs/os-specific/linux/selinux-sandbox/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
2.0 KiB
Nix
Raw Normal View History

2021-01-15 14:45:37 +00:00
{ lib, stdenv, fetchurl, bash, coreutils, python3
2018-03-15 22:57:19 +00:00
, libcap_ng, policycoreutils, selinux-python, dbus
, xorgserver, openbox, xmodmap }:
# this is python3 only as it depends on selinux-python
2021-01-15 14:45:37 +00:00
with lib;
2018-03-15 22:57:19 +00:00
with python3.pkgs;
stdenv.mkDerivation rec {
pname = "selinux-sandbox";
version = "3.3";
inherit (policycoreutils) se_url;
2018-03-15 22:57:19 +00:00
src = fetchurl {
url = "${se_url}/${version}/selinux-sandbox-${version}.tar.gz";
sha256 = "0rw8pxfqhl6ww4w31fbf4hi3zilh1n3b1rfjm7ra76mm78wfyylj";
2018-03-15 22:57:19 +00:00
};
nativeBuildInputs = [ wrapPython ];
buildInputs = [ bash coreutils libcap_ng policycoreutils python3 xorgserver openbox xmodmap dbus ];
propagatedBuildInputs = [ pygobject3 selinux-python ];
postPatch = ''
# Fix setuid install
substituteInPlace Makefile --replace "-m 4755" "-m 755"
substituteInPlace sandboxX.sh \
--replace "#!/bin/sh" "#!${bash}/bin/sh" \
--replace "/usr/share/sandbox/start" "${placeholder "out"}/share/sandbox/start" \
2018-03-15 22:57:19 +00:00
--replace "/usr/bin/cut" "${coreutils}/bin/cut" \
--replace "/usr/bin/Xephyr" "${xorgserver}/bin/Xepyhr" \
--replace "secon" "${policycoreutils}/bin/secon"
substituteInPlace sandbox \
--replace "/usr/sbin/seunshare" "$out/bin/seunshare" \
--replace "/usr/share/sandbox" "$out/share/sandbox" \
--replace "/usr/share/locale" "${policycoreutils}/share/locale" \
--replace "/usr/bin/openbox" "${openbox}/bin/openbox" \
--replace "#!/bin/sh" "#!${bash}/bin/sh" \
--replace "dbus-" "${dbus}/bin/dbus-" \
--replace "/usr/bin/xmodmap" "${xmodmap}/bin/xmodmap" \
--replace "/usr/bin/shred" "${coreutils}/bin/shred" \
--replace "/usr/bin/test" "${coreutils}/bin/test" \
'';
2019-08-17 17:49:50 +00:00
makeFlags = [
"PREFIX=$(out)"
"SYSCONFDIR=$(out)/etc/sysconfig"
];
2018-03-15 22:57:19 +00:00
postFixup = ''
wrapPythonPrograms
'';
meta = {
description = "SELinux sandbox utility";
license = licenses.gpl2;
homepage = "https://selinuxproject.org";
2018-03-15 22:57:19 +00:00
platforms = platforms.linux;
};
}