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