summary refs log tree commit diff
path: root/pkgs/os-specific/linux/apparmor
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-07-29 16:48:24 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-08-02 15:01:58 -0400
commit34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5 (patch)
treec8745f7e51296fe44c6a04927c1c60b040bbab84 /pkgs/os-specific/linux/apparmor
parent89a89ddfb3665561a3410420634ada773dfea691 (diff)
downloadnixlib-34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5.tar
nixlib-34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5.tar.gz
nixlib-34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5.tar.bz2
nixlib-34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5.tar.lz
nixlib-34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5.tar.xz
nixlib-34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5.tar.zst
nixlib-34da7e2ce2ca92bdeb73d8257e2ca145a0fc45a5.zip
treewide: Remove stdenv.isCross
I *want* cross-specific overrides to be verbose, so I rather not have
this shorthand. This makes the syntactic overhead more proportional to
the maintainence cost. Hopefully this pushes people towards fewer
conditionals and more abstractions.
Diffstat (limited to 'pkgs/os-specific/linux/apparmor')
-rw-r--r--pkgs/os-specific/linux/apparmor/default.nix24
1 files changed, 14 insertions, 10 deletions
diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix
index cbbe4d5ca462..08428f95b06c 100644
--- a/pkgs/os-specific/linux/apparmor/default.nix
+++ b/pkgs/os-specific/linux/apparmor/default.nix
@@ -2,9 +2,9 @@
 , pkgconfig, which
 , flex, bison
 , linuxHeaders ? stdenv.cc.libc.linuxHeaders
-, python
 , gawk
-, perl
+, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform && perl.meta.available or false, perl
+, withPython ? stdenv.hostPlatform == stdenv.buildPlatform && python.meta.available or false, python
 , swig
 , ncurses
 , pam
@@ -76,10 +76,9 @@ let
       perl
     ];
 
-    buildInputs = stdenv.lib.optionals (!stdenv.isCross) [
-      perl
-      python
-    ];
+    buildInputs = []
+      ++ stdenv.lib.optional withPerl perl
+      ++ stdenv.lib.optional withPython python;
 
     # required to build apparmor-parser
     dontDisableStatic = true;
@@ -92,11 +91,14 @@ let
 
     postPatch = "cd ./libraries/libapparmor";
     # https://gitlab.com/apparmor/apparmor/issues/1
-    configureFlags = stdenv.lib.optionalString (!stdenv.isCross) "--with-python --with-perl";
+    configureFlags = [
+      (stdenv.lib.withFeature withPerl "perl")
+      (stdenv.lib.withFeature withPython "python")
+    ];
 
-    outputs = if stdenv.isCross then [ "out" ] else [ "out" "python" ];
+    outputs = [ "out" ] ++ stdenv.lib.optional withPython "python";
 
-    postInstall = stdenv.lib.optionalString (!stdenv.isCross) ''
+    postInstall = stdenv.lib.optionalString withPython ''
       mkdir -p $python/lib
       mv $out/lib/python* $python/lib/
     '';
@@ -137,7 +139,9 @@ let
 
     inherit doCheck;
 
-    meta = apparmor-meta "user-land utilities";
+    meta = apparmor-meta "user-land utilities" // {
+      broken = !(withPython && withPerl);
+    };
   };
 
   apparmor-bin-utils = stdenv.mkDerivation {