2021-01-15 14:45:37 +00:00
|
|
|
{ lib, stdenv, fetchurl, python3
|
2018-03-20 13:56:08 +00:00
|
|
|
, libselinux, libsemanage, libsepol, setools }:
|
|
|
|
|
|
|
|
# this is python3 only because setools only supports python3
|
|
|
|
|
2021-01-15 14:45:37 +00:00
|
|
|
with lib;
|
2018-03-20 13:56:08 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "selinux-python";
|
2021-11-12 09:20:45 +00:00
|
|
|
version = "3.3";
|
2019-08-17 16:13:30 +00:00
|
|
|
|
2021-11-12 09:20:45 +00:00
|
|
|
inherit (libsepol) se_url;
|
2018-03-20 13:56:08 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-11-12 09:20:45 +00:00
|
|
|
url = "${se_url}/${version}/selinux-python-${version}.tar.gz";
|
|
|
|
sha256 = "1v244hpb45my303793xa4kcn7qnxjgxn4ja7rdn9k1q361hi1nca";
|
2018-03-20 13:56:08 +00:00
|
|
|
};
|
|
|
|
|
2021-11-12 11:28:15 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ python3 python3.pkgs.wrapPython ];
|
|
|
|
buildInputs = [ libsepol ];
|
|
|
|
propagatedBuildInputs = [ libselinux libsemanage setools python3.pkgs.ipy ];
|
2018-03-20 13:56:08 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace sepolicy/Makefile --replace "echo --root" "echo --prefix"
|
2019-08-17 16:13:30 +00:00
|
|
|
substituteInPlace sepolgen/src/share/Makefile --replace "/var/lib/sepolgen" \
|
|
|
|
"\$PREFIX/var/lib/sepolgen"
|
2018-03-20 13:56:08 +00:00
|
|
|
'';
|
|
|
|
|
2019-08-17 16:13:30 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"LOCALEDIR=$(out)/share/locale"
|
|
|
|
"BASHCOMPLETIONDIR=$(out)/share/bash-completion/completions"
|
|
|
|
"PYTHON=python"
|
2021-11-12 11:28:15 +00:00
|
|
|
"PYTHONLIBDIR=$(out)/${python3.sitePackages}"
|
2021-01-15 14:45:37 +00:00
|
|
|
"LIBSEPOLA=${lib.getLib libsepol}/lib/libsepol.a"
|
2019-08-17 16:13:30 +00:00
|
|
|
];
|
|
|
|
|
2018-03-20 13:56:08 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "SELinux policy core utilities written in Python";
|
|
|
|
license = licenses.gpl2;
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://selinuxproject.org";
|
2018-03-20 13:56:08 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|