opensmtpd: Add option that can disable adding sendmail to the system path

This commit is contained in:
Rickard Nilsson 2016-02-05 16:33:57 +01:00
parent 2b989f9d73
commit 5c20877d40

View File

@ -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 ];
};
}