summary refs log tree commit diff
path: root/pkgs/os-specific/linux/iwd/default.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-12-27 13:45:46 +0100
committerFlorian Klink <flokli@flokli.de>2020-12-27 13:47:52 +0100
commitd24918b70e5aaa41aaa55b393cd1341377acfb00 (patch)
tree73837f0d98b2f785c8ef1468e536ed67aa6fc8c3 /pkgs/os-specific/linux/iwd/default.nix
parent52261c4c2754ce26098eef93dd9354d3b6b4ef88 (diff)
downloadnixpkgs-d24918b70e5aaa41aaa55b393cd1341377acfb00.tar
nixpkgs-d24918b70e5aaa41aaa55b393cd1341377acfb00.tar.gz
nixpkgs-d24918b70e5aaa41aaa55b393cd1341377acfb00.tar.bz2
nixpkgs-d24918b70e5aaa41aaa55b393cd1341377acfb00.tar.lz
nixpkgs-d24918b70e5aaa41aaa55b393cd1341377acfb00.tar.xz
nixpkgs-d24918b70e5aaa41aaa55b393cd1341377acfb00.tar.zst
nixpkgs-d24918b70e5aaa41aaa55b393cd1341377acfb00.zip
iwd: fix cross compilation
This derivation uses wrapPython to wrap some "test scripts" that are
shipped in the "test" output.

As these test scripts require gobject-introspection, which doesn't
cross-compile at all, let's only patch and ship them when not
cross-compiling.
Diffstat (limited to 'pkgs/os-specific/linux/iwd/default.nix')
-rw-r--r--pkgs/os-specific/linux/iwd/default.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/iwd/default.nix b/pkgs/os-specific/linux/iwd/default.nix
index 64ac3342acf..0cbd7ff3a3a 100644
--- a/pkgs/os-specific/linux/iwd/default.nix
+++ b/pkgs/os-specific/linux/iwd/default.nix
@@ -21,7 +21,8 @@ stdenv.mkDerivation rec {
     sha256 = "0gzpdgfwzlqj2n3amf2zhi2hlpa412878yphgx79y6b5gn1y1lm2";
   };
 
-  outputs = [ "out" "man" "test" ];
+  outputs = [ "out" "man" ]
+    ++ stdenv.lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "test";
 
   nativeBuildInputs = [
     autoreconfHook
@@ -38,7 +39,9 @@ stdenv.mkDerivation rec {
 
   checkInputs = [ openssl ];
 
-  pythonPath = [
+  # wrapPython wraps the scripts in $test. They pull in gobject-introspection,
+  # which doesn't cross-compile.
+  pythonPath = stdenv.lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
     python3Packages.dbus-python
     python3Packages.pygobject3
   ];
@@ -61,11 +64,12 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   postInstall = ''
-    mkdir -p $test/bin
-    cp -a test/* $test/bin/
     mkdir -p $out/share
     cp -a doc $out/share/
     cp -a README AUTHORS TODO $out/share/doc/
+  '' + stdenv.lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
+    mkdir -p $test/bin
+    cp -a test/* $test/bin/
   '';
 
   preFixup = ''