email: improve how aliases are handled

This commit is contained in:
silver 2023-10-23 13:17:40 +01:00
parent 13eeead354
commit 53dd24bd1b

View file

@ -16,10 +16,12 @@ with lib; let
# thought you could escape racket? # thought you could escape racket?
create_filter = groups: create_filter_join (create_filter_array groups); create_filter = groups: create_filter_join (create_filter_array groups);
create_skynet_email = accounts: mailbox: (map (account: "${account}+${mailbox}@skynet.ie") accounts); # using +mailbox puts the mail in a seperate folder
create_skynet_email_int = accounts: mailbox: (map (account: "${account}+${mailbox}@skynet.ie") accounts);
create_skynet_email_admin = mailbox: (create_skynet_email config.skynet.users.admin mailbox) ++ ["int_${mailbox}@skynet.ie"]; groups_to_accounts = groups: builtins.concatMap (x: config.skynet.users.${x}) groups;
create_skynet_email_committee = mailbox: (create_skynet_email config.skynet.users.committee mailbox) ++ ["int_${mailbox}@skynet.ie"]; create_skynet_email_attribute = mailbox: groups: (create_skynet_email_int (groups_to_accounts groups) mailbox) ++ ["int_${mailbox}@skynet.ie"];
# { mailbox = [users]}
create_skynet_email = mailbox: groups: {"${mailbox}@skynet.ie" = create_skynet_email_attribute mailbox groups;};
in { in {
imports = [ imports = [
./dns.nix ./dns.nix
@ -260,22 +262,22 @@ in {
lmtpSaveToDetailMailbox = "yes"; lmtpSaveToDetailMailbox = "yes";
extraVirtualAliases = { extraVirtualAliases =
"root@skynet.ie" = create_skynet_email_admin "root"; {}
"abuse@skynet.ie" = create_skynet_email_admin "abuse"; // create_skynet_email "root" ["admin"]
"accounts@skynet.ie" = create_skynet_email_committee "accounts"; // create_skynet_email "abuse" ["admin"]
"compsoc@skynet.ie" = create_skynet_email_committee "compsoc"; // create_skynet_email "accounts" ["committee"]
"contact@skynet.ie" = create_skynet_email_committee "contact"; // create_skynet_email "compsoc" ["committee"]
"dbadmin@skynet.ie" = create_skynet_email_admin "dbadmin"; // create_skynet_email "contact" ["committee"]
"dnsadm@skynet.ie" = create_skynet_email_admin "dnsadm"; // create_skynet_email "dbadmin" ["admin"]
"hostmaster@skynet.ie" = create_skynet_email_admin "hostmaster"; // create_skynet_email "dnsadm" ["admin"]
"intersocsrep@skynet.ie" = create_skynet_email_committee "intersocsrep"; // create_skynet_email "hostmaster" ["admin"]
"mailman@skynet.ie" = create_skynet_email_admin "mailman"; // create_skynet_email "intersocsrep" ["committee"]
"security@skynet.ie" = create_skynet_email_admin "security"; // create_skynet_email "mailman" ["admin"]
"sysadm@skynet.ie" = create_skynet_email_admin "sysadm"; // create_skynet_email "security" ["admin"]
"webadmin@skynet.ie" = create_skynet_email_admin "webadmin"; // create_skynet_email "sysadm" ["admin"]
"pycon2023@skynet.ie" = create_skynet_email_committee "pycon2023"; // create_skynet_email "webadmin" ["admin"]
}; // create_skynet_email "pycon2023" ["committee"];
# use the letsencrypt certs # use the letsencrypt certs
certificateScheme = "acme"; certificateScheme = "acme";