about summary refs log tree commit diff
path: root/pkgs/shells/zsh/default.nix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2019-08-02 09:24:29 +0100
committerJörg Thalheim <joerg@thalheim.io>2019-08-02 10:04:10 +0100
commit84d2202a4613a116494f61b8cafd2be08acd0b22 (patch)
treead32109ca7ca160160dc421b84bcdfc80377f801 /pkgs/shells/zsh/default.nix
parent4e99e554b094071046be12b9611035f96c3a129b (diff)
zsh: fix cross-compiling support
Diffstat (limited to 'pkgs/shells/zsh/default.nix')
-rw-r--r--pkgs/shells/zsh/default.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkgs/shells/zsh/default.nix b/pkgs/shells/zsh/default.nix
index b74b2fc43f303..e9458520bb49e 100644
--- a/pkgs/shells/zsh/default.nix
+++ b/pkgs/shells/zsh/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses, pcre }:
+{ stdenv, fetchurl, ncurses, pcre, buildPackages }:
 
 let
   version = "5.7.1";
@@ -7,7 +7,6 @@ let
     url = "mirror://sourceforge/zsh/zsh-${version}-doc.tar.xz";
     sha256 = "1d1r88n1gfdavx4zy3svl1gljrvzim17jb2r834hafg2a016flrh";
   };
-
 in
 
 stdenv.mkDerivation {
@@ -61,7 +60,11 @@ else
   fi
 fi
 EOF
-    $out/bin/zsh -c "zcompile $out/etc/zprofile"
+    ${if stdenv.hostPlatform == stdenv.buildPlatform then ''
+      $out/bin/zsh -c "zcompile $out/etc/zprofile"
+    '' else ''
+      ${stdenv.lib.getBin buildPackages.zsh}/bin/zsh -c "zcompile $out/etc/zprofile"
+    ''}
     mv $out/etc/zprofile $out/etc/zprofile_zwc_is_used
   '';
   # XXX: patch zsh to take zwc if newer _or equal_