taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

postfix.scm (4895B)


      1 (define-module (custom-packages postfix)
      2   #:use-module (gnu packages databases)
      3   #:use-module (gnu packages m4)
      4   #:use-module (gnu packages pcre)
      5   #:use-module (gnu packages tls)
      6   #:use-module (gnu packages cyrus-sasl)
      7   #:use-module (gnu packages openldap)
      8   #:use-module (guix)
      9   #:use-module (guix utils)
     10   #:use-module (guix build-system gnu)
     11   #:use-module ((guix licenses) #:prefix license:))
     12 
     13 
     14 (define-public postfix
     15   (package
     16    (name "postfix")
     17    (version "3.3.2")
     18    (source (origin
     19             (method url-fetch)
     20             (uri (string-append
     21                   "http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/postfix-"
     22                   version ".tar.gz"))
     23             (sha256 (base32
     24                      "0nxkszdgs6fs86j6w1lf3vhxvjh1hw2jmrii5icqx9a9xqgg74rw"))))
     25    (native-inputs
     26      `(("m4" ,m4)))
     27    (inputs
     28      `(("bdb" ,bdb)
     29        ("openssl" ,openssl)
     30        ("sqlite" ,sqlite)
     31        ("pcre" ,pcre)
     32        ("postgresql" ,postgresql)
     33        ("openldap" ,openldap)
     34        ("cyrus-sasl" ,cyrus-sasl)
     35        ("lmdb" ,lmdb)))
     36    (build-system gnu-build-system)
     37    (arguments
     38      `(#:tests? #f ; Postfix does not come with any tests.
     39        #:phases
     40        (modify-phases %standard-phases
     41          (replace 'configure
     42            ;; Postfix does not have a standard "./configure".
     43            (lambda* (#:key outputs inputs configure-flags #:allow-other-keys)
     44              (define (dir-setting name dir)
     45 	       (string-append name "=" (assoc-ref outputs "out") dir))
     46 	     (invoke
     47 	       "make"
     48 	       "makefiles"
     49 	       (string-append "SHELL=" (which "sh"))
     50 	       (dir-setting "daemon_directory" "/libexec/postfix")
     51 	       (dir-setting "shlib_directory" "/lib/postfix")
     52 	       (dir-setting "command_directory" "/sbin")
     53 	       (dir-setting "manpage_directory" "/share/man")
     54 	       (dir-setting "newaliases_path" "/bin/newaliases")
     55 	       (dir-setting "mailq_path" "/bin/mailq")
     56 	       (dir-setting "sendmail_path" "/sbin/sendmail")
     57 	       (string-append
     58 		 "CCARGS="
     59 		 (string-join
     60 		   (list
     61 		     "-DHAS_DB"
     62 		     "-DHAS_LMDB"
     63 		     "-DHAS_PGSQL"
     64 		     "-DHAS_PCRE"
     65 		     "-DHAS_LDAP"
     66 		     "-DHAS_SQLITE"
     67 		     "-DUSE_TLS"
     68 		     "-DUSE_SASL_AUTH"
     69 		     "-DUSE_CYRUS_SASL"
     70 		     ;; only the default, can be changed at run time
     71 		     "-DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
     72 		     "-DNO_NIS"
     73 		     (string-append
     74 		       "-I"
     75 		       (assoc-ref inputs "cyrus-sasl")
     76 		       "/include/sasl"))
     77 		   " "))
     78 	       "shared=yes"
     79 	       (string-append
     80 		 "SHLIB_RPATH=-Wl,-rpath,"
     81 		 (assoc-ref outputs "out")
     82 		 "/lib/postfix")
     83 	       "dynamicmaps=yes"
     84 	       "AUXLIBS=-ldb -lresolv -lssl -lcrypto -lsasl2"
     85 	       "AUXLIBS_LMDB=-llmdb"
     86 	       "AUXLIBS_LDAP=-lldap -llber"
     87 	       "AUXLIBS_PCRE=-lpcre"
     88 	       "AUXLIBS_PGSQL=-lpq"
     89 	       "AUXLIBS_SQLITE=-lsqlite3 -lpthread")))
     90          (replace 'install
     91            ;; Postfix's "make install" is interactive, we work around this
     92            ;; by directly calling postfix-install with the right arguments.
     93            (lambda* (#:key outputs inputs configure-flags #:allow-other-keys)
     94 	     (substitute* "postfix-install"
     95 	      (("^SHELL=/bin/sh$") "SHELL=sh")
     96 	      (("^PATH=.*$") ""))
     97 	     (setenv "LD_LIBRARY_PATH"
     98 		     (string-append (getcwd) "/lib"))
     99 	     (invoke
    100 	       "sh"
    101 	       "postfix-install"
    102 	       (string-append "install_root=" (assoc-ref outputs "out"))
    103 	       "daemon_directory=/libexec/postfix"
    104 	       "command_directory=/sbin"
    105 	       "manpage_directory=/share/man"
    106 	       "newaliases_path=/bin/newaliases"
    107 	       "mailq_path=/bin/mailq"
    108 	       "sendmail_path=/sbin/sendmail"
    109 	       "shlib_directory=/lib/postfix"
    110 	       "-non-interactive"
    111 	       "-package")))
    112          (add-after 'install 'patch-master-cf
    113            ;; Make sure that the default main.cf does not contain wrong/confusing
    114            ;; paths.
    115            (lambda* (#:key outputs inputs configure-flags #:allow-other-keys)
    116              (define comment
    117                "# Note for Guix: This parameter should usually not be
    118 # changed, as the compiled-in default in the postfix
    119 # binaries already points to the Guix store.")
    120 	     (substitute* (string-append
    121                             (assoc-ref outputs "out")
    122                             "/etc/postfix/main.cf")
    123               (("^daemon_directory ?=" m) (string-append comment "\n#" m))))))))
    124    (synopsis "High-performance mail transport agent")
    125    (description
    126     "Postfix is Wietse Venema's mail transport agent that started
    127      life as an alternative to the widely-used Sendmail program.
    128      Postfix attempts to be fast, easy to administer, and secure,
    129      while at the same time being sendmail compatible enough to
    130      not upset existing users. Thus, the outside has a sendmail-ish
    131      flavor, but the inside is completely different.")
    132    (license license:ibmpl1.0)
    133    (home-page "http://www.postfix.org/")))