Loading nixos/modules/services/mail/maddy.nix +44 −7 Original line number Diff line number Diff line Loading @@ -223,14 +223,31 @@ in { ''; }; ensureAccounts = mkOption { type = types.listOf types.str; default = []; description = lib.mdDoc '' List of IMAP accounts which get automatically created. Note that for a complete setup, user credentials for these accounts are required too and can be created using the command `maddyctl creds`. This option does not delete accounts which are not (anymore) listed. ''; example = [ "user1@localhost" "user2@localhost" ]; }; }; }; config = mkIf cfg.enable { systemd = { packages = [ pkgs.maddy ]; services.maddy = { services = { maddy = { serviceConfig = { User = cfg.user; Group = cfg.group; Loading @@ -239,6 +256,26 @@ in { restartTriggers = [ config.environment.etc."maddy/maddy.conf".source ]; wantedBy = [ "multi-user.target" ]; }; maddy-ensure-accounts = { script = '' ${optionalString (cfg.ensureAccounts != []) '' ${concatMapStrings (account: '' if ! ${pkgs.maddy}/bin/maddyctl imap-acct list | grep "${account}"; then ${pkgs.maddy}/bin/maddyctl imap-acct create ${account} fi '') cfg.ensureAccounts} ''} ''; serviceConfig = { Type = "oneshot"; User= "maddy"; }; after = [ "maddy.service" ]; wantedBy = [ "multi-user.target" ]; }; }; }; environment.etc."maddy/maddy.conf" = { Loading nixos/tests/maddy.nix +1 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { hostname = "server"; primaryDomain = "server"; openFirewall = true; ensureAccounts = [ "postmaster@server" ]; }; }; Loading Loading @@ -50,7 +51,6 @@ import ./make-test-python.nix ({ pkgs, ... }: { server.wait_for_open_port(587) server.succeed("maddyctl creds create --password test postmaster@server") server.succeed("maddyctl imap-acct create postmaster@server") client.succeed("send-testmail") client.succeed("test-imap") Loading Loading
nixos/modules/services/mail/maddy.nix +44 −7 Original line number Diff line number Diff line Loading @@ -223,14 +223,31 @@ in { ''; }; ensureAccounts = mkOption { type = types.listOf types.str; default = []; description = lib.mdDoc '' List of IMAP accounts which get automatically created. Note that for a complete setup, user credentials for these accounts are required too and can be created using the command `maddyctl creds`. This option does not delete accounts which are not (anymore) listed. ''; example = [ "user1@localhost" "user2@localhost" ]; }; }; }; config = mkIf cfg.enable { systemd = { packages = [ pkgs.maddy ]; services.maddy = { services = { maddy = { serviceConfig = { User = cfg.user; Group = cfg.group; Loading @@ -239,6 +256,26 @@ in { restartTriggers = [ config.environment.etc."maddy/maddy.conf".source ]; wantedBy = [ "multi-user.target" ]; }; maddy-ensure-accounts = { script = '' ${optionalString (cfg.ensureAccounts != []) '' ${concatMapStrings (account: '' if ! ${pkgs.maddy}/bin/maddyctl imap-acct list | grep "${account}"; then ${pkgs.maddy}/bin/maddyctl imap-acct create ${account} fi '') cfg.ensureAccounts} ''} ''; serviceConfig = { Type = "oneshot"; User= "maddy"; }; after = [ "maddy.service" ]; wantedBy = [ "multi-user.target" ]; }; }; }; environment.etc."maddy/maddy.conf" = { Loading
nixos/tests/maddy.nix +1 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { hostname = "server"; primaryDomain = "server"; openFirewall = true; ensureAccounts = [ "postmaster@server" ]; }; }; Loading Loading @@ -50,7 +51,6 @@ import ./make-test-python.nix ({ pkgs, ... }: { server.wait_for_open_port(587) server.succeed("maddyctl creds create --password test postmaster@server") server.succeed("maddyctl imap-acct create postmaster@server") client.succeed("send-testmail") client.succeed("test-imap") Loading