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