GNU bug report logs - #59705
[PATCH] gnu: Add postfix.

Previous Next

Package: guix-patches;

Reported by: EuAndreh <eu <at> euandre.org>

Date: Wed, 30 Nov 2022 00:00:02 UTC

Severity: normal

Tags: moreinfo, patch

To reply to this bug, email your comments to 59705 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#59705; Package guix-patches. (Wed, 30 Nov 2022 00:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to EuAndreh <eu <at> euandre.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 30 Nov 2022 00:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: EuAndreh <eu <at> euandre.org>
To: guix-patches <at> gnu.org
Cc: EuAndreh <eu <at> euandre.org>
Subject: [PATCH] gnu: Add postfix.
Date: Tue, 29 Nov 2022 20:59:30 -0300
* gnu/packages/mail.scm (postfix): New variable.
---

Notes:
    This package has a few too many assumptions about the system where its
    running.
    
    Other than the usual call to hard-coded /bin/sh paths:
    
    - is too conservative on the PATH that the "master" process is launched
      into;
    - what is available to sbin(8) commands under their paths;
    - where the setuid programs live;
    - what should be the permissions of files under /etc/.
    
    It also has a very opinionated way of being given $PREFIX paths, and how
    the dynamic Makefiles are generated, how DESTDIR is handled, etc.
    
    I had disabled the "postconf -e" ability to edit configuration options
    in-place, as the postfix-service-type that I'm working on generates
    those files and puts the in the store, which isn't writable.
    
    All in all, this is a working package: this very email is sent from a
    local installation of Postfix in my Guix laptop, which forward the email
    to the server running Postfix under Guix, who than sends it off to the
    internet!  So if you're reading this, it is working :)

 gnu/packages/mail.scm | 125 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 125 insertions(+)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 754c9bc6de..c18ddced82 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -4876,3 +4876,128 @@ (define-public aerc
     ;; <https://lists.sr.ht/~rjarry/aerc-devel/%3Cb5cb213a7d0c699a886971658c2476
     ;; 1073eb2391%40disroot.org%3E>
     (license license:gpl3+)))
+
+(define-public postfix
+  (package
+    (name "postfix")
+    (version "3.8-20221023")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://cdn.postfix.johnriley.me/mirrors/postfix-release/experimental/postfix-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "0aaylhn81n9z3kidx53kzf2jrilr3lgwfxsk1r4hn7nkrp62bcwm"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:tests? #f
+           #:modules `((srfi srfi-26)
+                       ,@%gnu-build-system-modules)
+           #:phases #~(modify-phases %standard-phases
+                        (add-before 'configure 'patch-/bin/sh
+                          (lambda _
+                            (substitute* (find-files "." "^Makefile")
+                              (("/bin/sh")
+                               (which "sh")))))
+                        (add-before 'configure 'patch-bdb-include
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (substitute* "makedefs"
+                              (("/usr/include")
+                               (string-append (assoc-ref inputs "bdb")
+                                              "/include")))))
+                        (add-before 'configure 'dont-hardcode-PATH
+                          (lambda _
+                            (substitute* '("postfix-install"
+                                           "conf/post-install")
+                              (("^PATH=")
+                               "# PATH="))))
+                        (add-before 'configure 'fix-strict-PATH
+                          (lambda _
+                            (substitute* "src/util/sys_defs.h"
+                              (("^#define (ROOT_PATH|_PATH_DEFPATH|_PATH_STDPATH).*")
+                               "#define ROOT_PATH \"/run/setuid-programs:/run/current-system/profile/bin:/run/current-system/profile/sbin\"\n"))))
+                        (add-before 'configure 'use-relative-symlink-to-store
+                          (lambda _
+                            (substitute* "postfix-install"
+                              (("ln -sf")
+                               "ln -rsf"))))
+                        (add-before 'configure 'fix-absolute-path-to-setuid-programs
+                          (lambda _
+                            (substitute* "conf/postfix-script"
+                              (("\\$command_directory/postqueue")
+                               "/run/setuid-programs/postqueue")
+                              (("\\$command_directory/postdrop")
+                               "/run/setuid-programs/postdrop"))))
+                        (add-before 'configure 'disable-warning-on-non-writable-config-files
+                          (lambda _
+                            (substitute* "conf/postfix-script"
+                              (("find \\$todo \\\\\\( -perm -020 -o -perm -002 \\\\\\) \\\\\n")
+                               " # find $todo \\( -perm -020 -o -perm -002 \\)"))))
+                        (add-before 'configure 'disable-write-to-/etc/postfix
+                          (lambda _
+                            (substitute* "src/postconf/postconf_edit.c"
+                              (("pcf_set_config_dir.*")
+                               "return;"))))
+                        (add-before 'configure 'setup-environment
+                          (lambda* (#:key outputs inputs #:allow-other-keys)
+                            (setenv "CCARGS"
+                                    (string-append
+                                     "-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I"
+                                     (assoc-ref inputs "cyrus-sasl")
+                                     "/include/sasl"))
+                            (setenv "AUXLIBS" "-lnsl -lcrypto -lssl -lsasl2")
+                            (let* ((out (assoc-ref outputs "out"))
+                                   (bin (string-append out "/bin"))
+                                   (sbin (string-append out "/sbin"))
+                                   (lib (string-append out "/lib/postfix"))
+                                   (libexec (string-append out
+                                                           "/libexec/postfix"))
+                                   (etc (string-append out "/etc/postfix"))
+                                   (man (string-append out "/share/man"))
+                                   (doc (string-append out
+                                                       "/share/doc/postfix-"
+                                                       #$version))
+                                   (html (string-append doc "/html")))
+                              (setenv "install_root" "wip-prefix")
+                              (setenv "newaliases_path"
+                                      (string-append bin "/newaliases"))
+                              (setenv "mailq_path"
+                                      (string-append bin "/mailq"))
+                              (setenv "sendmail_path"
+                                      (string-append sbin "/sendmail"))
+                              (setenv "command_directory" sbin)
+                              (setenv "shlib_directory" lib)
+                              (setenv "daemon_directory" libexec)
+                              (setenv "meta_directory" etc)
+                              (setenv "sample_directory" etc)
+                              (setenv "manpage_directory" man)
+                              (setenv "readme_directory" doc)
+                              (setenv "html_directory" html)
+                              (setenv "sample_directory"
+                                      (string-append out "/share/postfix")))))
+                        (replace 'configure
+                          (lambda _
+                            (invoke "make" "makefiles" "pie=yes"
+                                    "dynamicmaps=yes")))
+                        (replace 'install
+                          (lambda* (#:key outputs #:allow-other-keys)
+                            (let ((out (assoc-ref outputs "out")))
+                              (invoke "make" "non-interactive-package")
+                              (delete-file-recursively "wip-prefix/var")
+                              (copy-recursively "wip-prefix/etc"
+                                                (string-append out "/etc"))
+                              (copy-recursively (string-append "wip-prefix"
+                                                               out) out)))))))
+    (inputs (list bdb cyrus-sasl libnsl openssl perl))
+    (native-inputs (list m4))
+    (home-page "https://www.postfix.org")
+    (synopsis "sendmail compatible MTA")
+    (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 (list license:ibmpl1.0 license:epl2.0))))
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59705; Package guix-patches. (Wed, 30 Nov 2022 23:33:01 GMT) Full text and rfc822 format available.

Message #8 received at 59705 <at> debbugs.gnu.org (full text, mbox):

From: EuAndreh <eu <at> euandre.org>
To: 59705 <at> debbugs.gnu.org
Cc: cwebber <at> dustycloud.org, brantcgardner <at> brantware.com, rekado <at> elephly.net,
 janneke <at> gnu.org
Subject: Re: [bug#59705] [PATCH] gnu: Add postfix.
Date: Wed, 30 Nov 2022 23:32:11 +0000
Talking about this with rekado on IRC, it reminded me that I found out 
about the "wip-postfix" branch after I started working on this package. 
This patch supersedes it, and I took inspiration from it during the 
final tweaks.

I'm Cc'ing some people involved in previous discussions about Postfix on 
Guix, and wip-postfix, and invite you to review it too: :)

I'm doing the final polishing touches on postfix-service-type, alongsige 
with cyrus-sasl-service-type and dkimproxyout-service-type to have a 
fully compliant woking mail server.




Added tag(s) moreinfo. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 14 Dec 2022 11:37:02 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 184 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.