From 1cdd9a3fe67b77a2cd23f4bc363cb019e966af71 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 4 Sep 2022 13:49:26 +0000 Subject: [PATCH] nixos/mailman: add serve.virtualRoot option On spectrum-os.org, mailman-web is run at /lists. With this change, it's possible for us to switch from a custom uWSGI configuration to the one now built in to the Mailman module. --- nixos/modules/services/mail/mailman.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/mail/mailman.nix b/nixos/modules/services/mail/mailman.nix index 7ae0a33332e9..198c2f3280f5 100644 --- a/nixos/modules/services/mail/mailman.nix +++ b/nixos/modules/services/mail/mailman.nix @@ -263,6 +263,15 @@ in { serve = { enable = mkEnableOption (lib.mdDoc "Automatic nginx and uwsgi setup for mailman-web"); + + virtualRoot = mkOption { + default = "/"; + example = lib.literalExpression "/lists"; + type = types.str; + description = lib.mdDoc '' + Path to mount the mailman-web django application on. + ''; + }; }; extraPythonPackages = mkOption { @@ -433,8 +442,8 @@ in { enable = mkDefault true; virtualHosts = lib.genAttrs cfg.webHosts (webHost: { locations = { - "/".extraConfig = "uwsgi_pass unix:/run/mailman-web.socket;"; - "/static/".alias = webSettings.STATIC_ROOT + "/"; + ${cfg.serve.virtualRoot}.extraConfig = "uwsgi_pass unix:/run/mailman-web.socket;"; + "${cfg.serve.virtualRoot}/static/".alias = webSettings.STATIC_ROOT + "/"; }; }); }; @@ -561,7 +570,8 @@ in { type = "normal"; plugins = ["python3"]; home = webEnv; - module = "mailman_web.wsgi"; + manage-script-name = true; + mount = "${cfg.serve.virtualRoot}=mailman_web.wsgi:application"; http = "127.0.0.1:18507"; }; uwsgiConfigFile = pkgs.writeText "uwsgi-mailman.json" (builtins.toJSON uwsgiConfig);