mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 04:50:21 +00:00
uwsgi service: redefine PATH envvar
Previously if user had `PATH` variable set we would define several
`PATH` variables and trigger a conflict.
(cherry picked from commit 4be78f0dd3)
This commit is contained in:
committed by
github-actions[bot]
parent
00acdb2aa8
commit
91bb3baea7
@@ -48,13 +48,10 @@ let
|
||||
pyhome = "${pythonEnv}";
|
||||
env =
|
||||
# Argh, uwsgi expects list of key-values there instead of a dictionary.
|
||||
let env' = c.env or [];
|
||||
getPath =
|
||||
x: if hasPrefix "PATH=" x
|
||||
then substring (stringLength "PATH=") (stringLength x) x
|
||||
else null;
|
||||
oldPaths = filter (x: x != null) (map getPath env');
|
||||
in env' ++ [ "PATH=${optionalString (oldPaths != []) "${last oldPaths}:"}${pythonEnv}/bin" ];
|
||||
let envs = partition (hasPrefix "PATH=") (c.env or []);
|
||||
oldPaths = map (x: substring (stringLength "PATH=") (stringLength x) x) envs.right;
|
||||
paths = oldPaths ++ [ "${pythonEnv}/bin" ];
|
||||
in [ "PATH=${concatStringsSep ":" paths}" ] ++ envs.wrong;
|
||||
}
|
||||
else if isEmperor
|
||||
then {
|
||||
|
||||
Reference in New Issue
Block a user