From bece34b65e88d3885e67327def760a6436cfb4e5 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Mon, 9 Oct 2023 17:53:22 +0100 Subject: [PATCH] feat: roughly set up virtual aliases to use. Will need to see if I cna get the idea merged in upstream. Closes https://gitlab.skynet.ie/compsoc1/skynet/nixos/-/issues/22 --- applications/email.nix | 79 ++++++++++++++++++++++++++++++++++++++++++ flake.lock | 12 ++++--- flake.nix | 3 +- 3 files changed, 88 insertions(+), 6 deletions(-) diff --git a/applications/email.nix b/applications/email.nix index 5275bd7..2faa98c 100644 --- a/applications/email.nix +++ b/applications/email.nix @@ -15,12 +15,20 @@ with lib; let # thought you could escape racket? create_filter = groups: create_filter_join (create_filter_array groups); + + create_skynet_email = accounts: (map (account: "${account}@skynet.ie") accounts); + + create_skynet_email_admin = create_skynet_email config.users.admin; + create_skynet_email_committee = create_skynet_email config.users.committee; in { imports = [ ./dns.nix ./acme.nix ./nginx.nix inputs.simple-nixos-mailserver.nixosModule + + # for teh config + ../config/users.nix ]; options.services.skynet_email = { @@ -226,6 +234,77 @@ in { cfg.domain ]; + extraVirtualAliases = { + "abuse@skynet.ie" = + [ + "abuse_int@skynet.ie" + ] + ++ create_skynet_email_admin; + + "accounts@skynet.ie" = + [ + "accounts_int@skynet.ie" + ] + ++ create_skynet_email_committee; + + "compsoc@skynet.ie" = + [ + "compsoc_int@skynet.ie" + ] + ++ create_skynet_email_committee; + "contact@skynet.ie" = + [ + "contact_int@skynet.ie" + ] + ++ create_skynet_email_committee; + + "dbadmin@skynet.ie" = + [ + "dbadmin_int@skynet.ie" + ] + ++ create_skynet_email_admin; + + "dnsadm@skynet.ie" = + [ + "dnsadm_int@skynet.ie" + ] + ++ create_skynet_email_admin; + + "hostmaster@skynet.ie" = + [ + "hostmaster_int@skynet.ie" + ] + ++ create_skynet_email_admin; + + "intersocsrep@skynet.ie" = + [ + "intersocsrep_int@skynet.ie" + ] + ++ create_skynet_email_committee; + + "mailman@skynet.ie" = + [ + "mailman_int@skynet.ie" + ] + ++ create_skynet_email_admin; + + "security@skynet.ie" = + [ + "security_int@skynet.ie" + ] + ++ create_skynet_email_admin; + "sysadm@skynet.ie" = + [ + "sysadm_int@skynet.ie" + ] + ++ create_skynet_email_admin; + "webadmin@skynet.ie" = + [ + "webadmin_int@skynet.ie" + ] + ++ create_skynet_email_admin; + }; + # use the letsencrypt certs certificateScheme = "acme"; diff --git a/flake.lock b/flake.lock index fb35479..3b2cae9 100644 --- a/flake.lock +++ b/flake.lock @@ -634,15 +634,17 @@ "utils": "utils_3" }, "locked": { - "lastModified": 1689976554, - "narHash": "sha256-uWJq3sIhkqfzPmfB2RWd5XFVooGFfSuJH9ER/r302xQ=", - "owner": "simple-nixos-mailserver", + "host": "gitlab.skynet.ie", + "lastModified": 1696865182, + "narHash": "sha256-zyUUOA+RiwRjLP6+zi80p5pqftYK3+9yIN5wQ9VlGkw=", + "owner": "compsoc1%2Fskynet%2Fmisc", "repo": "nixos-mailserver", - "rev": "c63f6e7b053c18325194ff0e274dba44e8d2271e", + "rev": "14007ae0eaeba4cc0235135f872122e398f09040", "type": "gitlab" }, "original": { - "owner": "simple-nixos-mailserver", + "host": "gitlab.skynet.ie", + "owner": "compsoc1%2Fskynet%2Fmisc", "repo": "nixos-mailserver", "type": "gitlab" } diff --git a/flake.nix b/flake.nix index c61d17a..0b8cf47 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,8 @@ }; # email - simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; + # simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; + simple-nixos-mailserver.url = "gitlab:compsoc1%2Fskynet%2Fmisc/nixos-mailserver?host=gitlab.skynet.ie"; # account.skynet.ie skynet_ldap_backend.url = "gitlab:compsoc1%2Fskynet%2Fldap/backend?host=gitlab.skynet.ie";