From 4e8643ea6c79a8bd9f6429983df20aac91256385 Mon Sep 17 00:00:00 2001 From: Gábor Boskovits Date: Mon, 3 Feb 2020 13:31:34 +0100 Subject: gnu: Add postfix. * gnu/packages/mail.scm (postfix-minimal): New variable. Co-authored-by: Brant Gardner --- gnu/packages/mail.scm | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm index ecaab1c7cd..52a1c2ac8d 100644 --- a/gnu/packages/mail.scm +++ b/gnu/packages/mail.scm @@ -40,6 +40,7 @@ ;;; Copyright © 2020 Oleg Pykhalov ;;; Copyright © 2020 B. Wilson ;;; Copyright © 2020 divoplade +;;; Copyright © 2020 Brant Gardner ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Benoit Joly ;;; Copyright © 2021 Morgan Smith @@ -4964,3 +4965,109 @@ (define-public aerc ;; (license license:gpl3+))) + +(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"))))) + ;; 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"))))) + (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")))) + ;; 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")))) + (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"))) + ;; 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"))))) + ;; 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")))) + ;; 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 + (list bdb libnsl)) + (native-inputs + (list coreutils + findutils + gawk + m4 + sed)) + (home-page "https://www.postfix.org") + (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))) -- cgit v1.2.3