summary refs log tree commit diff
path: root/nixos/modules/services/mail/opensmtpd.nix
diff options
context:
space:
mode:
authorRickard Nilsson <rickynils@gmail.com>2016-02-05 16:33:57 +0100
committerRickard Nilsson <rickynils@gmail.com>2016-02-06 11:54:56 +0100
commit5c20877d40726b6973d222f71fa6e306428c19cf (patch)
treee00d3c4c7d776cdce2713d20947fc73abdc9a0dd /nixos/modules/services/mail/opensmtpd.nix
parent2b989f9d73187c0db9fefea0e2d70b9cb61409f4 (diff)
downloadnixpkgs-5c20877d40726b6973d222f71fa6e306428c19cf.tar
nixpkgs-5c20877d40726b6973d222f71fa6e306428c19cf.tar.gz
nixpkgs-5c20877d40726b6973d222f71fa6e306428c19cf.tar.bz2
nixpkgs-5c20877d40726b6973d222f71fa6e306428c19cf.tar.lz
nixpkgs-5c20877d40726b6973d222f71fa6e306428c19cf.tar.xz
nixpkgs-5c20877d40726b6973d222f71fa6e306428c19cf.tar.zst
nixpkgs-5c20877d40726b6973d222f71fa6e306428c19cf.zip
opensmtpd: Add option that can disable adding sendmail to the system path
Diffstat (limited to 'nixos/modules/services/mail/opensmtpd.nix')
-rw-r--r--nixos/modules/services/mail/opensmtpd.nix21
1 files changed, 16 insertions, 5 deletions
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix
index a1cfd84365a..42a1244cde5 100644
--- a/nixos/modules/services/mail/opensmtpd.nix
+++ b/nixos/modules/services/mail/opensmtpd.nix
@@ -9,6 +9,11 @@ let
   conf = writeText "smtpd.conf" cfg.serverConfiguration;
   args = concatStringsSep " " cfg.extraServerArgs;
 
+  sendmail = pkgs.runCommand "opensmtpd-sendmail" {} ''
+    mkdir -p $out/bin
+    ln -s ${opensmtpd}/sbin/smtpctl $out/bin/sendmail
+  '';
+
 in {
 
   ###### interface
@@ -23,6 +28,15 @@ in {
         description = "Whether to enable the OpenSMTPD server.";
       };
 
+      addSendmailToSystemPath = mkOption {
+        type = types.bool;
+        default = true;
+        description = ''
+          Whether to add OpenSMTPD's sendmail binary to the
+          system path or not.
+        '';
+      };
+
       extraServerArgs = mkOption {
         type = types.listOf types.str;
         default = [];
@@ -64,7 +78,7 @@ in {
 
   ###### implementation
 
-  config = mkIf config.services.opensmtpd.enable {
+  config = mkIf cfg.enable {
     users.extraGroups = {
       smtpd.gid = config.ids.gids.smtpd;
       smtpq.gid = config.ids.gids.smtpq;
@@ -98,9 +112,6 @@ in {
       environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
     };
 
-    environment.systemPackages = [ (pkgs.runCommand "opensmtpd-sendmail" {} ''
-      mkdir -p $out/bin
-      ln -s ${opensmtpd}/sbin/smtpctl $out/bin/sendmail
-    '') ];
+    environment.systemPackages = mkIf cfg.addSendmailToSystemPath [ sendmail ];
   };
 }