forked from mirrors/nixpkgs
opensmtpd: Add option that can disable adding sendmail to the system path
This commit is contained in:
parent
2b989f9d73
commit
5c20877d40
1 changed files with 16 additions and 5 deletions
|
@ -9,6 +9,11 @@ let
|
||||||
conf = writeText "smtpd.conf" cfg.serverConfiguration;
|
conf = writeText "smtpd.conf" cfg.serverConfiguration;
|
||||||
args = concatStringsSep " " cfg.extraServerArgs;
|
args = concatStringsSep " " cfg.extraServerArgs;
|
||||||
|
|
||||||
|
sendmail = pkgs.runCommand "opensmtpd-sendmail" {} ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s ${opensmtpd}/sbin/smtpctl $out/bin/sendmail
|
||||||
|
'';
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
|
@ -23,6 +28,15 @@ in {
|
||||||
description = "Whether to enable the OpenSMTPD server.";
|
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 {
|
extraServerArgs = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -64,7 +78,7 @@ in {
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf config.services.opensmtpd.enable {
|
config = mkIf cfg.enable {
|
||||||
users.extraGroups = {
|
users.extraGroups = {
|
||||||
smtpd.gid = config.ids.gids.smtpd;
|
smtpd.gid = config.ids.gids.smtpd;
|
||||||
smtpq.gid = config.ids.gids.smtpq;
|
smtpq.gid = config.ids.gids.smtpq;
|
||||||
|
@ -98,9 +112,6 @@ in {
|
||||||
environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
|
environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ (pkgs.runCommand "opensmtpd-sendmail" {} ''
|
environment.systemPackages = mkIf cfg.addSendmailToSystemPath [ sendmail ];
|
||||||
mkdir -p $out/bin
|
|
||||||
ln -s ${opensmtpd}/sbin/smtpctl $out/bin/sendmail
|
|
||||||
'') ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue