From patchwork Tue Nov 29 23:59:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: EuAndreh X-Patchwork-Id: 44973 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E8BB527BBEC; Wed, 30 Nov 2022 00:00:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1DE4E27BBE9 for ; Wed, 30 Nov 2022 00:00:14 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0AWD-0007V6-H0; Tue, 29 Nov 2022 19:00:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0AWB-0007UY-Mb for guix-patches@gnu.org; Tue, 29 Nov 2022 19:00:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0AWB-0003yC-8u for guix-patches@gnu.org; Tue, 29 Nov 2022 19:00:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0AWA-0004t2-N3 for guix-patches@gnu.org; Tue, 29 Nov 2022 19:00:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59705] [PATCH] gnu: Add postfix. Resent-From: EuAndreh Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 30 Nov 2022 00:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59705 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59705@debbugs.gnu.org Cc: EuAndreh X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166976639618748 (code B ref -1); Wed, 30 Nov 2022 00:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Nov 2022 23:59:56 +0000 Received: from localhost ([127.0.0.1]:57270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0AW0-0004sK-Fm for submit@debbugs.gnu.org; Tue, 29 Nov 2022 18:59:55 -0500 Received: from lists.gnu.org ([209.51.188.17]:35170) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0AVv-0004sC-GQ for submit@debbugs.gnu.org; Tue, 29 Nov 2022 18:59:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0AVu-00079B-1p for guix-patches@gnu.org; Tue, 29 Nov 2022 18:59:46 -0500 Received: from euandre.org ([216.238.68.100]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0AVj-0003sO-Ra for guix-patches@gnu.org; Tue, 29 Nov 2022 18:59:45 -0500 Received: from euandre.org (localhost [127.0.0.1]) by euandre.org (Postfix) with ESMTP id D9B483794D5; Tue, 29 Nov 2022 20:59:32 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=euandre.org; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=dkimproxy; bh=8znTFtWve98jqKGbIU2A FnFv2Vg=; b=khByN+zfaPJQaT1SVtQj7zedk3bL4IBCvPE67VABKW1AmMkStHPW yefkwynxzCOyYoQH0XRd5yRnyo5RiMUWalZRH5nwv3j8HE4v4bAhuond6vIvhaKr ChCFRu8uHypjRjBZYrgGE0Zb1/kkqtD85Vzgy8dmMQetq1FA3YvdkfigkyJzzXu6 LClz867IjfCGSCE7DYPOiys3Cshi7ow4tQXkjF4pAdZfMiFabbeSRBOhjz2QKMsM /1sWc91XhW1QPC6RIZ8GHjZ9FW1ybxXpVu91GVOxWaoKZ7KGcOfXxq2D+Tj3RwMP 89LNR8b24s7bISFumq2QT7hR5fGG+YLEfQ== Date: Tue, 29 Nov 2022 20:59:30 -0300 Message-Id: <20221129235930.2532-1-eu@euandre.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Received-SPF: pass client-ip=216.238.68.100; envelope-from=eu@euandre.org; helo=euandre.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: EuAndreh X-ACL-Warn: , EuAndreh via Guix-patches X-Patchwork-Original-From: EuAndreh via Guix-patches via From: EuAndreh Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 ;; (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))))