From 03541914ae2e572953e71d689cb6bd12034017db Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 16 Jan 2025 18:50:01 +0100 Subject: [PATCH] feat(django-apps): Automatically add admins --- modules/nixos/django-apps/default.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/nixos/django-apps/default.nix b/modules/nixos/django-apps/default.nix index 6dbacc2..c13de69 100644 --- a/modules/nixos/django-apps/default.nix +++ b/modules/nixos/django-apps/default.nix @@ -134,6 +134,17 @@ in ''; }; + admins = mkOption { + type = attrsOf str; + default = { }; + description = '' + Admins of this website, they will be added to the ADMINS credential. + ''; + example = { + "Toto Example" = "toto@example.com"; + }; + }; + serveMedia = mkOption { type = bool; default = true; @@ -662,6 +673,10 @@ in STATIC_ROOT = "/var/lib/django-apps/${name}/${config.staticDirectory}"; MEDIA_ROOT = "/var/lib/django-apps/${name}/${config.mediaDirectory}"; ALLOWED_HOSTS = [ config.domain ]; + ADMINS = mapAttrsToList (name: email: [ + name + email + ]) ({ "Admins DGNum" = "admins+dj-${name}@dgnum.eu"; } // config.admins); }) // { DJANGO_SETTINGS_MODULE = config.application.settingsModule;