diff options
author | Rickard Nilsson <rickynils@gmail.com> | 2016-02-05 16:33:57 +0100 |
---|---|---|
committer | Rickard Nilsson <rickynils@gmail.com> | 2016-02-06 11:54:56 +0100 |
commit | 5c20877d40726b6973d222f71fa6e306428c19cf (patch) | |
tree | e00d3c4c7d776cdce2713d20947fc73abdc9a0dd /nixos/modules | |
parent | 2b989f9d73187c0db9fefea0e2d70b9cb61409f4 (diff) | |
download | nixlib-5c20877d40726b6973d222f71fa6e306428c19cf.tar nixlib-5c20877d40726b6973d222f71fa6e306428c19cf.tar.gz nixlib-5c20877d40726b6973d222f71fa6e306428c19cf.tar.bz2 nixlib-5c20877d40726b6973d222f71fa6e306428c19cf.tar.lz nixlib-5c20877d40726b6973d222f71fa6e306428c19cf.tar.xz nixlib-5c20877d40726b6973d222f71fa6e306428c19cf.tar.zst nixlib-5c20877d40726b6973d222f71fa6e306428c19cf.zip |
opensmtpd: Add option that can disable adding sendmail to the system path
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/mail/opensmtpd.nix | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix index a1cfd84365a2..42a1244cde57 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 ]; }; } |