mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/maddy: add package option
This commit is contained in:
parent
250b695f41
commit
baf2d3e27f
1 changed files with 9 additions and 7 deletions
|
@ -143,6 +143,8 @@ in
|
||||||
|
|
||||||
enable = lib.mkEnableOption "Maddy, a free an open source mail server";
|
enable = lib.mkEnableOption "Maddy, a free an open source mail server";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "maddy" { };
|
||||||
|
|
||||||
user = lib.mkOption {
|
user = lib.mkOption {
|
||||||
default = "maddy";
|
default = "maddy";
|
||||||
type = with lib.types; uniq str;
|
type = with lib.types; uniq str;
|
||||||
|
@ -386,7 +388,7 @@ in
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
|
|
||||||
packages = [ pkgs.maddy ];
|
packages = [ cfg.package ];
|
||||||
services = {
|
services = {
|
||||||
maddy = {
|
maddy = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
@ -402,16 +404,16 @@ in
|
||||||
script = ''
|
script = ''
|
||||||
${lib.optionalString (cfg.ensureAccounts != [ ]) ''
|
${lib.optionalString (cfg.ensureAccounts != [ ]) ''
|
||||||
${lib.concatMapStrings (account: ''
|
${lib.concatMapStrings (account: ''
|
||||||
if ! ${pkgs.maddy}/bin/maddyctl imap-acct list | grep "${account}"; then
|
if ! ${cfg.package}/bin/maddyctl imap-acct list | grep "${account}"; then
|
||||||
${pkgs.maddy}/bin/maddyctl imap-acct create ${account}
|
${cfg.package}/bin/maddyctl imap-acct create ${account}
|
||||||
fi
|
fi
|
||||||
'') cfg.ensureAccounts}
|
'') cfg.ensureAccounts}
|
||||||
''}
|
''}
|
||||||
${lib.optionalString (cfg.ensureCredentials != { }) ''
|
${lib.optionalString (cfg.ensureCredentials != { }) ''
|
||||||
${lib.concatStringsSep "\n" (
|
${lib.concatStringsSep "\n" (
|
||||||
lib.mapAttrsToList (name: cfg: ''
|
lib.mapAttrsToList (name: credentials: ''
|
||||||
if ! ${pkgs.maddy}/bin/maddyctl creds list | grep "${name}"; then
|
if ! ${cfg.package}/bin/maddyctl creds list | grep "${name}"; then
|
||||||
${pkgs.maddy}/bin/maddyctl creds create --password $(cat ${lib.escapeShellArg cfg.passwordFile}) ${name}
|
${cfg.package}/bin/maddyctl creds create --password $(cat ${lib.escapeShellArg credentials.passwordFile}) ${name}
|
||||||
fi
|
fi
|
||||||
'') cfg.ensureCredentials
|
'') cfg.ensureCredentials
|
||||||
)}
|
)}
|
||||||
|
@ -486,7 +488,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.maddy
|
cfg.package
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue