about summary refs log tree commit diff
path: root/nixpkgs/nixos
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-09-04 13:49:26 +0000
committerAlyssa Ross <hi@alyssa.is>2023-06-05 20:43:58 +0000
commitd528b92e6d475d1265580b221dfc1457c8c5df41 (patch)
treeba10fa712011e11efe7b5cff7c4a46dc4b9e0405 /nixpkgs/nixos
parentfb3cd36c21c92d6c241fa0855401481fb013d6d1 (diff)
downloadnixlib-d528b92e6d475d1265580b221dfc1457c8c5df41.tar
nixlib-d528b92e6d475d1265580b221dfc1457c8c5df41.tar.gz
nixlib-d528b92e6d475d1265580b221dfc1457c8c5df41.tar.bz2
nixlib-d528b92e6d475d1265580b221dfc1457c8c5df41.tar.lz
nixlib-d528b92e6d475d1265580b221dfc1457c8c5df41.tar.xz
nixlib-d528b92e6d475d1265580b221dfc1457c8c5df41.tar.zst
nixlib-d528b92e6d475d1265580b221dfc1457c8c5df41.zip
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.

(cherry picked from commit 1cdd9a3fe67b77a2cd23f4bc363cb019e966af71)
Diffstat (limited to 'nixpkgs/nixos')
-rw-r--r--nixpkgs/nixos/modules/services/mail/mailman.nix16
1 files changed, 13 insertions, 3 deletions
diff --git a/nixpkgs/nixos/modules/services/mail/mailman.nix b/nixpkgs/nixos/modules/services/mail/mailman.nix
index 6a17c6f1a78a..1e942c17c5f9 100644
--- a/nixpkgs/nixos/modules/services/mail/mailman.nix
+++ b/nixpkgs/nixos/modules/services/mail/mailman.nix
@@ -258,6 +258,15 @@ in {
 
       serve = {
         enable = mkEnableOption "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.
+          '';
+        };
       };
 
       settings = mkOption {
@@ -428,8 +437,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 + "/";
         };
       });
     };
@@ -553,7 +562,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);