summary refs log tree commit diff
path: root/pkgs/servers/mail/postfix/default.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2012-08-28 15:17:06 +0200
committerPeter Simons <simons@cryp.to>2012-08-28 15:17:06 +0200
commit85350ca2d44fc272d893e566be3044920524d4e5 (patch)
treebda087f7789905aa615d8dfbf4bd814ffcb9eb90 /pkgs/servers/mail/postfix/default.nix
parent40fe2d03b5e294ba5456f34d55e1efd427ef942c (diff)
downloadnixpkgs-85350ca2d44fc272d893e566be3044920524d4e5.tar
nixpkgs-85350ca2d44fc272d893e566be3044920524d4e5.tar.gz
nixpkgs-85350ca2d44fc272d893e566be3044920524d4e5.tar.bz2
nixpkgs-85350ca2d44fc272d893e566be3044920524d4e5.tar.lz
nixpkgs-85350ca2d44fc272d893e566be3044920524d4e5.tar.xz
nixpkgs-85350ca2d44fc272d893e566be3044920524d4e5.tar.zst
nixpkgs-85350ca2d44fc272d893e566be3044920524d4e5.zip
postfix: clean-up install phase
Passing install_root=$out isn't a good idea because the install script is going
to pre-pend that prefix to all other paths even though these have the $out
prefix already. The resulting installation is a mess. Instead, we use the
"fake" install prefix "out" and then move all files and directories into the
right place afterward.
Diffstat (limited to 'pkgs/servers/mail/postfix/default.nix')
-rw-r--r--pkgs/servers/mail/postfix/default.nix47
1 files changed, 22 insertions, 25 deletions
diff --git a/pkgs/servers/mail/postfix/default.nix b/pkgs/servers/mail/postfix/default.nix
index 37a3869a733..d505f459b9e 100644
--- a/pkgs/servers/mail/postfix/default.nix
+++ b/pkgs/servers/mail/postfix/default.nix
@@ -12,23 +12,14 @@ stdenv.mkDerivation rec {
     sha256 = "1rfsfhna5hy5lc6hkg1zc2862pdc5c1y9z6aiy8rinlmzrfplhlb";
   };
 
-  installTargets = ["non-interactive-package"];
-  
-  installFlags = [" install_root=$out "];
-  
-  preInstall = ''
-    sed -e '/^PATH=/d' -i postfix-install
-  '';
-  
-  postInstall = ''
-    mkdir -p $out
-    mv ut/$out/* $out/
+  buildInputs = [db4 openssl cyrus_sasl bison perl];
 
-    mkdir $out/share/postfix/conf
-    cp conf/* $out/share/postfix/conf
-    sed -e 's@PATH=.*@PATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:'$out'/sbin@' -i $out/share/postfix/conf/post-install $out/libexec/postfix/post-install
-    sed -e '2aPATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:'$out'/sbin' -i $out/share/postfix/conf/postfix-script $out/libexec/postfix/postfix-script
-    chmod a+x $out/share/postfix/conf/{postfix-script,post-install}
+  patches = [ ./postfix-2.2.9-db.patch  ./postfix-2.2.9-lib.patch ./db-linux3.patch ];
+
+  postPatch = ''
+    sed -i -e s,/usr/bin,/var/run/current-system/sw/bin, \
+      -e s,/usr/sbin,/var/run/current-system/sw/sbin, \
+      -e s,:/sbin,, src/util/sys_defs.h
   '';
 
   preBuild = ''
@@ -46,14 +37,23 @@ stdenv.mkDerivation rec {
     make makefiles CCARGS='-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I${cyrus_sasl}/include/sasl' AUXLIBS='-lssl -lcrypto -lsasl2 -ldb -lnsl'
   '';
 
-  buildInputs = [db4 openssl cyrus_sasl bison perl];
+  installPhase = ''
+    sed -e '/^PATH=/d' -i postfix-install
+    $SHELL postfix-install install_root=out -non-interactive -package
 
-  patches = [ ./postfix-2.2.9-db.patch  ./postfix-2.2.9-lib.patch ./db-linux3.patch ];
+    mkdir -p $out
+    mv -v "out$out/"* $out/
 
-  postPatch = ''
-    sed -i -e s,/usr/bin,/var/run/current-system/sw/bin, \
-      -e s,/usr/sbin,/var/run/current-system/sw/sbin, \
-      -e s,:/sbin,, src/util/sys_defs.h
+    mkdir -p $out/share/postfix
+    mv conf $out/share/postfix/
+    mv LICENSE TLS_LICENSE $out/share/postfix/
+
+    sed -e 's@^PATH=.*@PATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:'$out'/sbin@' -i $out/share/postfix/conf/post-install $out/libexec/postfix/post-install
+    sed -e '2aPATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:'$out'/sbin' -i $out/share/postfix/conf/postfix-script $out/libexec/postfix/postfix-script
+    chmod a+x $out/share/postfix/conf/{postfix-script,post-install}
+  '';
+
+  inherit glibc;
 
   meta = {
     homepage = "http://www.postfix.org/";
@@ -62,7 +62,4 @@ stdenv.mkDerivation rec {
     platforms = stdenv.lib.platforms.linux;
     maintainers = [ stdenv.lib.maintainers.simons ];
   };
-  '';
-
-  inherit glibc;
 }