summary refs log tree commit diff
path: root/nixos/modules/services/mail
diff options
context:
space:
mode:
authorLéo Gaspard <leo@gaspard.io>2018-06-18 09:46:47 +0200
committerLéo Gaspard <leo@gaspard.io>2018-06-18 09:49:01 +0200
commitbb08686f1e3c274979f842e8d405e381b1e41658 (patch)
tree6e6498bc1013d5242a7bb225946b5ef9fa118229 /nixos/modules/services/mail
parent4b649a99d8461c980e7028a693387dc48033c1f7 (diff)
downloadnixlib-bb08686f1e3c274979f842e8d405e381b1e41658.tar
nixlib-bb08686f1e3c274979f842e8d405e381b1e41658.tar.gz
nixlib-bb08686f1e3c274979f842e8d405e381b1e41658.tar.bz2
nixlib-bb08686f1e3c274979f842e8d405e381b1e41658.tar.lz
nixlib-bb08686f1e3c274979f842e8d405e381b1e41658.tar.xz
nixlib-bb08686f1e3c274979f842e8d405e381b1e41658.tar.zst
nixlib-bb08686f1e3c274979f842e8d405e381b1e41658.zip
opensmtpd module: allow changing the package
Diffstat (limited to 'nixos/modules/services/mail')
-rw-r--r--nixos/modules/services/mail/opensmtpd.nix13
1 files changed, 10 insertions, 3 deletions
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix
index 53acdba42457..f9b890532ceb 100644
--- a/nixos/modules/services/mail/opensmtpd.nix
+++ b/nixos/modules/services/mail/opensmtpd.nix
@@ -10,7 +10,7 @@ let
 
   sendmail = pkgs.runCommand "opensmtpd-sendmail" {} ''
     mkdir -p $out/bin
-    ln -s ${pkgs.opensmtpd}/sbin/smtpctl $out/bin/sendmail
+    ln -s ${cfg.package}/sbin/smtpctl $out/bin/sendmail
   '';
 
 in {
@@ -27,6 +27,13 @@ in {
         description = "Whether to enable the OpenSMTPD server.";
       };
 
+      package = mkOption {
+        type = types.package;
+        default = pkgs.opensmtpd;
+        defaultText = "pkgs.opensmtpd";
+        description = "The OpenSMTPD package to use.";
+      };
+
       addSendmailToSystemPath = mkOption {
         type = types.bool;
         default = true;
@@ -97,7 +104,7 @@ in {
     systemd.services.opensmtpd = let
       procEnv = pkgs.buildEnv {
         name = "opensmtpd-procs";
-        paths = [ pkgs.opensmtpd ] ++ cfg.procPackages;
+        paths = [ cfg.package ] ++ cfg.procPackages;
         pathsToLink = [ "/libexec/opensmtpd" ];
       };
     in {
@@ -115,7 +122,7 @@ in {
         chown smtpq.root /var/spool/smtpd/purge
         chmod 700 /var/spool/smtpd/purge
       '';
-      serviceConfig.ExecStart = "${pkgs.opensmtpd}/sbin/smtpd -d -f ${conf} ${args}";
+      serviceConfig.ExecStart = "${cfg.package}/sbin/smtpd -d -f ${conf} ${args}";
       environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
     };