about summary refs log tree commit diff
path: root/nixos/modules/services/web-servers/uwsgi.nix
diff options
context:
space:
mode:
authorSymphorien Gibol <symphorien+git@xlumurb.eu>2019-09-16 17:08:32 +0200
committersymphorien+git@xlumurb.eu <Symphorien Gibol>2019-11-02 12:00:00 +0000
commit32d2266d0df1eeddd28f4d52fc7c04d734deb2f5 (patch)
treec2818d9408d4ce4d836530667b9f1b8b4557f930 /nixos/modules/services/web-servers/uwsgi.nix
parent0107ee8c322e57cdb2ebcc1c9c4286ff7db53d5c (diff)
ihatemoney: init at 4.1 plus module and test
Diffstat (limited to 'nixos/modules/services/web-servers/uwsgi.nix')
-rw-r--r--nixos/modules/services/web-servers/uwsgi.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixos/modules/services/web-servers/uwsgi.nix b/nixos/modules/services/web-servers/uwsgi.nix
index af70f32f32d0f..66537b29cd21d 100644
--- a/nixos/modules/services/web-servers/uwsgi.nix
+++ b/nixos/modules/services/web-servers/uwsgi.nix
@@ -5,10 +5,6 @@ with lib;
 let
   cfg = config.services.uwsgi;
 
-  uwsgi = pkgs.uwsgi.override {
-    plugins = cfg.plugins;
-  };
-
   buildCfg = name: c:
     let
       plugins =
@@ -23,8 +19,8 @@ let
       python =
         if hasPython2 && hasPython3 then
           throw "`plugins` attribute in UWSGI configuration shouldn't contain both python2 and python3"
-        else if hasPython2 then uwsgi.python2
-        else if hasPython3 then uwsgi.python3
+        else if hasPython2 then cfg.package.python2
+        else if hasPython3 then cfg.package.python3
         else null;
 
       pythonEnv = python.withPackages (c.pythonPackages or (self: []));
@@ -77,6 +73,11 @@ in {
         description = "Where uWSGI communication sockets can live";
       };
 
+      package = mkOption {
+        type = types.package;
+        internal = true;
+      };
+
       instance = mkOption {
         type = types.attrs;
         default = {
@@ -138,7 +139,7 @@ in {
       '';
       serviceConfig = {
         Type = "notify";
-        ExecStart = "${uwsgi}/bin/uwsgi --uid ${cfg.user} --gid ${cfg.group} --json ${buildCfg "server" cfg.instance}/server.json";
+        ExecStart = "${cfg.package}/bin/uwsgi --uid ${cfg.user} --gid ${cfg.group} --json ${buildCfg "server" cfg.instance}/server.json";
         ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
         ExecStop = "${pkgs.coreutils}/bin/kill -INT $MAINPID";
         NotifyAccess = "main";
@@ -156,5 +157,9 @@ in {
       { name = "uwsgi";
         gid = config.ids.gids.uwsgi;
       });
+
+    services.uwsgi.package = pkgs.uwsgi.override {
+      inherit (cfg) plugins;
+    };
   };
 }