Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 makeWrapper, 4 gawk, 5 perl, 6 bash, 7 stdenv, 8 which, 9 linuxHeaders ? stdenv.cc.libc.linuxHeaders, 10 python3Packages, 11 bashNonInteractive, 12 buildPackages, 13 14 # apparmor deps 15 libapparmor, 16 apparmor-parser, 17 apparmor-teardown, 18}: 19python3Packages.buildPythonApplication { 20 pname = "apparmor-utils"; 21 inherit (libapparmor) version src; 22 23 postPatch = '' 24 patchShebangs . 25 cd utils 26 27 substituteInPlace aa-remove-unknown \ 28 --replace-fail "/lib/apparmor/rc.apparmor.functions" "${apparmor-parser}/lib/apparmor/rc.apparmor.functions" 29 substituteInPlace Makefile \ 30 --replace-fail "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h" 31 sed -i -E 's/^(DESTDIR|BINDIR|PYPREFIX)=.*//g' Makefile 32 sed -i aa-unconfined -e "/my_env\['PATH'\]/d" 33 '' 34 + (lib.optionalString stdenv.hostPlatform.isMusl '' 35 sed -i Makefile -e "/\<vim\>/d" 36 ''); 37 38 format = "other"; 39 strictDeps = true; 40 41 doCheck = true; 42 43 nativeBuildInputs = [ 44 makeWrapper 45 which 46 bashNonInteractive 47 python3Packages.setuptools 48 ]; 49 50 buildInputs = [ 51 bash 52 perl 53 ]; 54 55 pythonPath = [ 56 python3Packages.notify2 57 python3Packages.psutil 58 libapparmor 59 ]; 60 61 makeFlags = [ 62 "LANGS=" 63 "POD2MAN=${lib.getExe' buildPackages.perl "pod2man"}" 64 "POD2HTML=${lib.getExe' buildPackages.perl "pod2html"}" 65 "MANDIR=share/man" 66 ]; 67 68 installFlags = [ 69 "DESTDIR=$(out)" 70 "BINDIR=$(out)/bin" 71 "VIM_INSTALL_PATH=$(out)/share" 72 "PYPREFIX=" 73 ]; 74 75 postInstall = '' 76 wrapProgram $out/bin/aa-remove-unknown \ 77 --prefix PATH : ${lib.makeBinPath [ gawk ]} 78 79 ln -s ${lib.getExe apparmor-teardown} $out/bin/aa-teardown 80 ''; 81 82 meta = libapparmor.meta // { 83 description = "Mandatory access control system - script user-land utilities"; 84 }; 85}