at 18.09-beta 1.5 kB view raw
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 name = "selinux-python-${version}"; 11 version = "2.7"; 12 se_release = "20170804"; 13 se_url = "https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases"; 14 15 src = fetchurl { 16 url = "${se_url}/${se_release}/selinux-python-${version}.tar.gz"; 17 sha256 = "1va0y4b7cah7rprh04b3ylmwqgnivpkw5z2zw68nrafdbsbcn5s2"; 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 ''; 27 28 preBuild = '' 29 makeFlagsArray+=("PREFIX=$out") 30 makeFlagsArray+=("DESTDIR=$out") 31 makeFlagsArray+=("LOCALEDIR=$out/share/locale") 32 makeFlagsArray+=("LIBSEPOLA=${stdenv.lib.getLib libsepol}/lib/libsepol.a") 33 makeFlagsArray+=("BASHCOMPLETIONDIR=$out/share/bash-completion/completions") 34 makeFlagsArray+=("PYTHON=${python3}/bin/python") 35 makeFlagsArray+=("PYTHONLIBDIR=lib/${python3.libPrefix}/site-packages") 36 ''; 37 38 postFixup = '' 39 wrapPythonPrograms 40 ''; 41 42 meta = { 43 description = "SELinux policy core utilities written in Python"; 44 license = licenses.gpl2; 45 homepage = https://selinuxproject.org; 46 platforms = platforms.linux; 47 }; 48} 49