summary refs log tree commit diff
path: root/pkgs/os-specific/linux/selinux-python/default.nix
diff options
context:
space:
mode:
authorxeji <xeji@cat3.de>2018-03-20 14:56:08 +0100
committerxeji <xeji@cat3.de>2018-03-23 14:30:02 +0100
commit905f4725562b8cf07d1a75fd6e5d6573d5cb5520 (patch)
treee75d3d830350b9ecade7084926bbab9c8a2c70a6 /pkgs/os-specific/linux/selinux-python/default.nix
parentcc8bf58427a39c765f3c039951ab3cf7e9533e24 (diff)
downloadnixpkgs-905f4725562b8cf07d1a75fd6e5d6573d5cb5520.tar
nixpkgs-905f4725562b8cf07d1a75fd6e5d6573d5cb5520.tar.gz
nixpkgs-905f4725562b8cf07d1a75fd6e5d6573d5cb5520.tar.bz2
nixpkgs-905f4725562b8cf07d1a75fd6e5d6573d5cb5520.tar.lz
nixpkgs-905f4725562b8cf07d1a75fd6e5d6573d5cb5520.tar.xz
nixpkgs-905f4725562b8cf07d1a75fd6e5d6573d5cb5520.tar.zst
nixpkgs-905f4725562b8cf07d1a75fd6e5d6573d5cb5520.zip
selinux-python: init at 2.7
tools written in python that upstream moved from policycoreutils
into a separate package
Diffstat (limited to 'pkgs/os-specific/linux/selinux-python/default.nix')
-rw-r--r--pkgs/os-specific/linux/selinux-python/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/selinux-python/default.nix b/pkgs/os-specific/linux/selinux-python/default.nix
new file mode 100644
index 00000000000..8ac207d6421
--- /dev/null
+++ b/pkgs/os-specific/linux/selinux-python/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, python3
+, libselinux, libsemanage, libsepol, setools }:
+
+# this is python3 only because setools only supports python3
+
+with stdenv.lib;
+with python3.pkgs;
+
+stdenv.mkDerivation rec {
+  name = "selinux-python-${version}";
+  version = "2.7";
+  se_release = "20170804";
+  se_url = "https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases";
+
+  src = fetchurl {
+    url = "${se_url}/${se_release}/selinux-python-${version}.tar.gz";
+    sha256 = "1va0y4b7cah7rprh04b3ylmwqgnivpkw5z2zw68nrafdbsbcn5s2";
+  };
+
+  nativeBuildInputs = [ wrapPython ];
+  buildInputs = [ libsepol python3 ];
+  propagatedBuildInputs = [ libselinux libsemanage setools ipy ];
+
+  postPatch = ''
+    substituteInPlace sepolicy/Makefile --replace "echo --root" "echo --prefix"
+  '';
+
+  preBuild = ''
+    makeFlagsArray+=("PREFIX=$out")
+    makeFlagsArray+=("DESTDIR=$out")
+    makeFlagsArray+=("LOCALEDIR=$out/share/locale")
+    makeFlagsArray+=("LIBSEPOLA=${libsepol}/lib/libsepol.a")
+    makeFlagsArray+=("BASHCOMPLETIONDIR=$out/share/bash-completion/completions")
+    makeFlagsArray+=("PYTHON=${python3}/bin/python")
+    makeFlagsArray+=("PYTHONLIBDIR=lib/${python3.libPrefix}/site-packages")
+  '';
+
+  postFixup = ''
+    wrapPythonPrograms
+  '';
+
+  meta = {
+    description = "SELinux policy core utilities written in Python";
+    license = licenses.gpl2;
+    homepage = https://selinuxproject.org;
+    platforms = platforms.linux;
+  };
+}
+