ihatemoney: init at 4.1 plus module and test
This commit is contained in:
committed by
symphorien+git@xlumurb.eu
parent
0107ee8c32
commit
32d2266d0d
@@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user