git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #153589 from abbradar/uwsgi-fixes

uWSGI configuration generation fixes

commite8daaa85d484e132ffbeac78651a2e6e56b9f8fb authorNikolay Amiantov <ab@fmap.me> dateSun 9 Jan 2022, 09:49 (5 years ago) parent0ecf7d42be5e93
1 file changed+7−9
nixos/modules/services/web-servers/uwsgi.nix+7−9
nixos/modules/services/web-servers/uwsgi.nix+7−9
@@ -20,10 +20,11 @@ let
2020
2121 buildCfg = name: c:
2222 let
23− plugins =
23+ plugins' =
2424 if any (n: !any (m: m == n) cfg.plugins) (c.plugins or [])
2525 then throw "`plugins` attribute in uWSGI configuration contains plugins not in config.services.uwsgi.plugins"
2626 else c.plugins or cfg.plugins;
27+ plugins = unique plugins';
2728
2829 hasPython = v: filter (n: n == "python${v}") plugins != [];
2930 hasPython2 = hasPython "2";
@@ -48,13 +49,10 @@ let
4849 pyhome = "${pythonEnv}";
4950 env =
5051 # Argh, uwsgi expects list of key-values there instead of a dictionary.
51− let env' = c.env or [];
52− getPath =
53− x: if hasPrefix "PATH=" x
54− then substring (stringLength "PATH=") (stringLength x) x
55− else null;
56− oldPaths = filter (x: x != null) (map getPath env');
57− in env' ++ [ "PATH=${optionalString (oldPaths != []) "${last oldPaths}:"}${pythonEnv}/bin" ];
52+ let envs = partition (hasPrefix "PATH=") (c.env or []);
53+ oldPaths = map (x: substring (stringLength "PATH=") (stringLength x) x) envs.right;
54+ paths = oldPaths ++ [ "${pythonEnv}/bin" ];
55+ in [ "PATH=${concatStringsSep ":" paths}" ] ++ envs.wrong;
5856 }
5957 else if isEmperor
6058 then {
@@ -225,7 +223,7 @@ in {
225223 };
226224
227225 services.uwsgi.package = pkgs.uwsgi.override {
228− inherit (cfg) plugins;
226+ plugins = unique cfg.plugins;
229227 };
230228 };
231229}