git.iko.soy/typeable/nixpkgs
on master help sign in
uwsgi service: redefine PATH envvar

Previously if user had `PATH` variable set we would define several `PATH` variables and trigger a conflict.

commit4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50 authorNikolay Amiantov <ab@fmap.me> dateWed 5 Jan 2022, 14:13 (5 years ago) parent78cd22c
1 file changed+4−7
nixos/modules/services/web-servers/uwsgi.nix+4−7
nixos/modules/services/web-servers/uwsgi.nix+4−7
@@ -48,13 +48,10 @@ let
4848 pyhome = "${pythonEnv}";
4949 env =
5050 # 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" ];
51+ let envs = partition (hasPrefix "PATH=") (c.env or []);
52+ oldPaths = map (x: substring (stringLength "PATH=") (stringLength x) x) envs.right;
53+ paths = oldPaths ++ [ "${pythonEnv}/bin" ];
54+ in [ "PATH=${concatStringsSep ":" paths}" ] ++ envs.wrong;
5855 }
5956 else if isEmperor
6057 then {