1{ lib, fetchFromGitHub, python3
2, libsepol, libselinux, checkpolicy
3, withGraphics ? false
4}:
5
6with lib;
7with python3.pkgs;
8
9buildPythonApplication rec {
10 pname = "setools";
11 version = "4.5.0";
12
13 src = fetchFromGitHub {
14 owner = "SELinuxProject";
15 repo = pname;
16 rev = "refs/tags/${version}";
17 hash = "sha256-4y4Uhh3O84UbK39j8ACu06/6n7lyHsd8MzODR0FOp3I=";
18 };
19
20 nativeBuildInputs = [ cython ];
21 buildInputs = [ libsepol ];
22 propagatedBuildInputs = [ enum34 libselinux networkx setuptools ]
23 ++ optionals withGraphics [ pyqt5 ];
24
25 nativeCheckInputs = [ tox checkpolicy ];
26 preCheck = ''
27 export CHECKPOLICY=${checkpolicy}/bin/checkpolicy
28 '';
29
30 setupPyBuildFlags = [ "-i" ];
31
32 preBuild = ''
33 export SEPOL="${lib.getLib libsepol}/lib/libsepol.a"
34 '';
35
36 meta = {
37 description = "SELinux Policy Analysis Tools";
38 homepage = "https://github.com/SELinuxProject/setools";
39 license = licenses.gpl2;
40 platforms = platforms.linux;
41 };
42}