Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, fetchurl, python3
2, libselinux, libsemanage, libsepol, setools }:
3
4# this is python3 only because setools only supports python3
5
6with stdenv.lib;
7with python3.pkgs;
8
9stdenv.mkDerivation rec {
10 pname = "selinux-python";
11 version = "2.9";
12
13 inherit (libsepol) se_release se_url;
14
15 src = fetchurl {
16 url = "${se_url}/${se_release}/selinux-python-${version}.tar.gz";
17 sha256 = "1pjzsyay5535cxcjag7y7k193ajry0s0xc3dqv5905qd7cwval1n";
18 };
19
20 nativeBuildInputs = [ wrapPython ];
21 buildInputs = [ libsepol python3 ];
22 propagatedBuildInputs = [ libselinux libsemanage setools ipy ];
23
24 postPatch = ''
25 substituteInPlace sepolicy/Makefile --replace "echo --root" "echo --prefix"
26 substituteInPlace sepolgen/src/share/Makefile --replace "/var/lib/sepolgen" \
27 "\$PREFIX/var/lib/sepolgen"
28 '';
29
30 makeFlags = [
31 "PREFIX=$(out)"
32 "LOCALEDIR=$(out)/share/locale"
33 "BASHCOMPLETIONDIR=$(out)/share/bash-completion/completions"
34 "PYTHON=python"
35 "PYTHONLIBDIR=$(out)/${python.sitePackages}"
36 "LIBSEPOLA=${stdenv.lib.getLib libsepol}/lib/libsepol.a"
37 ];
38
39
40 postFixup = ''
41 wrapPythonPrograms
42 '';
43
44 meta = {
45 description = "SELinux policy core utilities written in Python";
46 license = licenses.gpl2;
47 homepage = "https://selinuxproject.org";
48 platforms = platforms.linux;
49 };
50}
51