guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/07: gnu: Add postfix.


From: guix-commits
Subject: 01/07: gnu: Add postfix.
Date: Mon, 10 Aug 2020 02:49:33 -0400 (EDT)

janneke pushed a commit to branch wip-postfix
in repository guix.

commit 7e133889bcf3e1d6baf1a0111fbc0b866c278156
Author: Gábor Boskovits <boskovits@gmail.com>
AuthorDate: Mon Feb 3 13:31:34 2020 +0100

    gnu: Add postfix.
    
    * gnu/packages/mail.scm (postfix-minimal): New variable.
    
    Co-authored-by: Brant Gardner <brantcgardner@brantware.com>
---
 gnu/packages/mail.scm | 117 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 116 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 8563b47..a2708ed 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -26,7 +26,7 @@
 ;;; Copyright © 2017, 2018, 2020 Rene Saavedra <pacoon@protonmail.com>
 ;;; Copyright © 2018, 2019, 2020 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
-;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
+;;; Copyright © 2018, 2020 Gábor Boskovits <boskovits@gmail.com>
 ;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Tanguy Le Carrour <tanguy@bioneland.org>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
@@ -34,6 +34,7 @@
 ;;; Copyright © 2020 Eric Brown <ecbrown@ericcbrown.com>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020 Brant Gardner <brantcgardner@brantware.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -74,6 +75,7 @@
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages enchant)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages gdb)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
@@ -3552,3 +3554,116 @@ DKIM and ARC sign messages and output the corresponding 
signature headers.")
 based on asyncio.")
     (license (list license:asl2.0
                    license:lgpl3))))    ; only for setup_helpers.py
+
+(define-public postfix-minimal
+  (package
+    (name "postfix-minimal")
+    (version "3.4.8")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://cdn.postfix.johnriley.me/";
+                                  "mirrors/postfix-release/official/"
+                                  "postfix-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0hw9kbr05qdzvfqhxi4dp4n3s9xvdh0gr0la08a4bip06ybl4pcd"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'patch-/bin/sh
+           (lambda _
+             (substitute* (find-files "." "^Makefile.in")
+               (("/bin/sh") (which "sh")))
+             #t))
+         ;; allow us to find the bdb headers
+         (add-before 'build 'patch-/usr/include
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* '("makedefs")
+               (("/usr/include") (string-append (assoc-ref inputs "bdb")
+                                                "/include")))
+             #t))
+         (add-before 'build 'set-up-environment
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; os detection on Guix System does not provide this
+             (setenv "AUXLIBS" "-lnsl")
+             ;; have to set this here, so that we get the correct
+             ;; location in the compiled binaries
+             (setenv "shlib_directory" (assoc-ref outputs "out"))
+             #t))
+         ;; do not allow writes to the configuration directory,
+         ;; so that we can keep that in the store
+         (add-before 'build 'disable-postconf-edit
+           (lambda _
+             (substitute* "src/postconf/postconf_edit.c"
+               (("pcf_set_config_dir\\(\\);") "return 0;"))))
+         (add-before 'build 'configure-compile
+           (lambda _
+             (invoke "make" "makefiles" "pie=yes" "dynamicmaps=yes")))
+         (add-before 'install 'fix-postfix-scripts-path
+           (lambda _
+             (for-each
+              (lambda (command)
+                (substitute* '("postfix-install" "conf/post-install" 
"conf/postfix-script")
+                  (((string-append command " ")) (string-append (which 
command) " "))))
+              '("awk" "chmod" "chown" "chgrp" "cp" "find" "ln" "mkdir" "mv" 
"rm" "sed"
+                "sleep" "sort" "touch" "uname"))
+             #t))
+         (add-before 'install 'configure-install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "sendmail_path" (string-append out "/sendmail"))
+               (setenv "newaliases_path" (string-append out "/newaliases"))
+               (setenv "mailq_path" (string-append out "/mailq"))
+               (setenv "command_directory" out)
+               (setenv "config_directory" out)
+               (setenv "daemon_directory" out)
+               (setenv "data_directory" out)
+               (setenv "html_directory" out)
+               (setenv "queue_directory" out)
+               (setenv "manpage_directory" out)
+               (setenv "sample_directory" out)
+               (setenv "meta_directory" out)
+               (setenv "readme_directory" out))
+             (setenv "tempdir" "/tmp")
+             #t))
+         ;; done in the service activation snippet
+         ;; we don't have the account here
+         (add-before 'fix-postfix-scripts-path 'disable-chown
+           (lambda _
+             (substitute* "postfix-install"
+               (("chown") (which "true")))
+             (substitute* "postfix-install"
+               (("chgrp") (which "true")))
+             #t))
+         ;; disable writing the configuration files (service provides these)
+         ;; disable chowning (does not matter, stuff ends up in the store)
+         ;; and disable live update code (we always install to a clean 
directory)
+         (add-after 'configure-install 'disable-postinstall
+           (lambda _
+             (substitute* "postfix-install"
+               (("# we're sorry.") "exit 0"))
+             #t))
+         ;; postfix by default uses an interactive installer
+         ;; replacing it with the upgrade target allows for
+         ;; a non-interactive install.
+         (replace 'install
+           (lambda _
+             (invoke "make" "upgrade")))
+         (delete 'configure)
+         (delete 'check))))
+    (inputs `(("bdb" ,bdb)
+              ("libnsl" ,libnsl)))
+    (native-inputs `(("coreutils" ,coreutils)
+                     ("findutils" ,findutils)
+                     ("gawk" ,gawk)
+                     ("m4" ,m4)
+                     ("sed" ,sed)))
+    (home-page "http://www.postfix.org";) ; https disabled on server
+    (synopsis "Wietse Venema's mail server")
+    (description "Postfix is Wietse Venema's mail server that started life at
+IBM research as an alternative to the widely-used Sendmail program. Now at
+Google, Wietse continues to support Postfix. Postfix attempts to be fast, easy
+to administer, and secure. The outside has a definite Sendmail-ish flavor, but
+the inside is completely different.")
+    (license license:ibmpl1.0)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]