From c5c3dadc3c1a1403a0fbadbba16aedeb24e1c5ea Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 19 Aug 2025 10:43:07 +0200 Subject: [PATCH] update module --- module.nix | 65 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/module.nix b/module.nix index 7e8f965..5ec9a63 100644 --- a/module.nix +++ b/module.nix @@ -21,37 +21,40 @@ in config = lib.mkIf cfg.enable { - # uWSGI configuration (nixos-25.05 uses `instance`, not `instances`) - services.uwsgi.enable = true; - services.uwsgi.plugins = [ "python3" ]; - services.uwsgi.instance."fragify" = { - type = "normal"; - chdir = "/"; - # WSGI entry from packaged share dir - wsgi-file = "${pkgs.fragify}/share/fragify/fragify_wsgi.py"; - module = "fragify:app"; - # Socket - socket = "unix:${config.services.uwsgi.runDir}/fragify.sock"; - "chmod-socket" = "660"; - umask = "0077"; - vacuum = true; - master = true; - processes = 2; - threads = 2; - harakiri = 60; - "buffer-size" = 65535; - need-app = true; - "no-orphans" = true; - # Pass environment to the app - env = { - PYTHONPATH = "${pkgs.fragify.pythonPath}"; - FRAGIFY_TEMPLATES_DIR = "${pkgs.fragify}/share/fragify/templates"; - FRAGIFY_STATIC_DIR = "${pkgs.fragify}/share/fragify/assets"; - }; - # Python deps for the embedded interpreter moved to PYTHONPATH in env - # Extra raw uWSGI settings not covered by module options - settings = { - "static-map" = "/static=${pkgs.fragify}/share/fragify/assets"; + # global uwsgi settings (once) + services.uwsgi = { + enable = true; + plugins = [ "python3" ]; + # run the emperor + instance = { + type = "emperor"; + vassals = { + fragify = { + type = "normal"; + chdir = "/"; + wsgi-file = "${pkgs.fragify}/share/fragify/fragify_wsgi.py"; + module = "fragify:app"; + socket = "unix:${config.services.uwsgi.runDir}/fragify.sock"; + "chmod-socket" = "660"; + umask = "0077"; + vacuum = true; + master = true; + processes = 2; + threads = 2; + harakiri = 60; + "buffer-size" = 65535; + need-app = true; + "no-orphans" = true; + env = { + PYTHONPATH = "${pkgs.fragify.pythonPath}"; + FRAGIFY_TEMPLATES_DIR = "${pkgs.fragify}/share/fragify/templates"; + FRAGIFY_STATIC_DIR = "${pkgs.fragify}/share/fragify/assets"; + }; + settings = { + "static-map" = "/static=${pkgs.fragify}/share/fragify/assets"; + }; + }; + }; }; };