summary refs log tree commit diff
path: root/pkgs/servers/mail/postfix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2018-12-10 21:48:36 +0000
committerRobin Gloster <mail@glob.in>2018-12-11 18:13:21 +0100
commit68d5071e3d7593116810db503b9b1921d6f78702 (patch)
treed5b8cc6c4f62c1dcc26858fba27d83ffddb867f5 /pkgs/servers/mail/postfix
parent2ebe19f3302ee21871cfab11cdadd13f38b51261 (diff)
downloadnixpkgs-68d5071e3d7593116810db503b9b1921d6f78702.tar
nixpkgs-68d5071e3d7593116810db503b9b1921d6f78702.tar.gz
nixpkgs-68d5071e3d7593116810db503b9b1921d6f78702.tar.bz2
nixpkgs-68d5071e3d7593116810db503b9b1921d6f78702.tar.lz
nixpkgs-68d5071e3d7593116810db503b9b1921d6f78702.tar.xz
nixpkgs-68d5071e3d7593116810db503b9b1921d6f78702.tar.zst
nixpkgs-68d5071e3d7593116810db503b9b1921d6f78702.zip
postfix: fix cross-build
Diffstat (limited to 'pkgs/servers/mail/postfix')
-rw-r--r--pkgs/servers/mail/postfix/default.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/servers/mail/postfix/default.nix b/pkgs/servers/mail/postfix/default.nix
index e2a78477bb6..019cc1b1948 100644
--- a/pkgs/servers/mail/postfix/default.nix
+++ b/pkgs/servers/mail/postfix/default.nix
@@ -1,5 +1,6 @@
 { stdenv, lib, fetchurl, makeWrapper, gnused, db, openssl, cyrus_sasl, libnsl
 , coreutils, findutils, gnugrep, gawk, icu, pcre, m4
+, buildPackages
 , withLDAP ? true, openldap
 , withPgSQL ? false, postgresql
 , withMySQL ? false, mysql
@@ -49,13 +50,17 @@ in stdenv.mkDerivation rec {
     ./relative-symlinks.patch
   ];
 
-  preBuild = ''
+  postPatch = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    sed -e 's!bin/postconf!${buildPackages.postfix}/bin/postconf!' -i postfix-install
+  '' + ''
     sed -e '/^PATH=/d' -i postfix-install
     sed -e "s|@PACKAGE@|$out|" -i conf/post-install
 
     # post-install need skip permissions check/set on all symlinks following to /nix/store
     sed -e "s|@NIX_STORE@|$NIX_STORE|" -i conf/post-install
+  '';
 
+  postConfigure = ''
     export command_directory=$out/sbin
     export config_directory=/etc/postfix
     export meta_directory=$out/etc/postfix
@@ -69,6 +74,8 @@ in stdenv.mkDerivation rec {
     export readme_directory=$out/share/postfix/doc
     export sendmail_path=$out/bin/sendmail
 
+    makeFlagsArray+=(AR=$AR _AR=$AR RANLIB=$RANLIB _RANLIB=$RANLIB)
+
     make makefiles CCARGS='${ccargs}' AUXLIBS='${auxlibs}'
   '';