From 8595321b8e9a28c0ad2ff8afd5417176f5f8ca92 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Thu, 16 Feb 2023 23:11:57 +0100 Subject: [PATCH] upstream maddy mail server module customizations --- vm-nextcloud.nix | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/vm-nextcloud.nix b/vm-nextcloud.nix index 955cd4b..18d1fe7 100644 --- a/vm-nextcloud.nix +++ b/vm-nextcloud.nix @@ -4,12 +4,14 @@ { pkgs, config, lib, options, ... }: { + # FIXME disabledModules = [ "services/web-apps/nextcloud.nix" + "services/mail/maddy.nix" ]; - imports = [ ./nextcloud.nix + "${fetchTarball "https://github.com/onny/nixpkgs/archive/maddy-acc.tar.gz"}/nixos/modules/services/mail/maddy.nix" ]; nixpkgs = { @@ -107,6 +109,11 @@ config = lib.concatStrings ( builtins.match "(.*)authorize_sender.*identity\n[ ]+\}(.*)" options.services.maddy.config.default ); + ensureAccounts = [ + "user1@localhost" + "user2@localhost" + "admin@localhost" + ]; }; # Configure local mail delivery @@ -127,28 +134,17 @@ # FIXME: Upstream systemd.services.maddy-accounts = { script = '' - #!${runtimeShell} + #!${pkgs.runtimeShell} - if not ${pkgs.maddy}/bin/maddyctl creds list | grep "user1@localhost"; then + if ! ${pkgs.maddy}/bin/maddyctl creds list | grep "user1@localhost"; then ${pkgs.maddy}/bin/maddyctl creds create --password test123 user1@localhost fi - if not ${pkgs.maddy}/bin/maddyctl imap-acct list | grep "user1@localhost"; then - ${pkgs.maddy}/bin/maddyctl imap-acct create user1@localhost - fi - - if not ${pkgs.maddy}/bin/maddyctl creds list | grep "user2@localhost"; then + if ! ${pkgs.maddy}/bin/maddyctl creds list | grep "user2@localhost"; then ${pkgs.maddy}/bin/maddyctl creds create --password test123 user2@localhost fi - if not ${pkgs.maddy}/bin/maddyctl imap-acct list | grep "user2@localhost"; then - ${pkgs.maddy}/bin/maddyctl imap-acct create user2@localhost - fi - - if not ${pkgs.maddy}/bin/maddyctl creds list | grep "admin@localhost"; then + if ! ${pkgs.maddy}/bin/maddyctl creds list | grep "admin@localhost"; then ${pkgs.maddy}/bin/maddyctl creds create --password test123 admin@localhost fi - if not ${pkgs.maddy}/bin/maddyctl imap-acct list | grep "admin@localhost"; then - ${pkgs.maddy}/bin/maddyctl imap-acct create admin@localhost - fi ''; serviceConfig = { Type = "oneshot";