diff options
author | Nikolay Amiantov <ab@fmap.me> | 2022-01-05 14:13:37 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2022-01-05 14:18:59 +0300 |
commit | 4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50 (patch) | |
tree | ed8c200b250affc9da09d1e791ff636961b0687c | |
parent | 78cd22c1b8604de423546cd49bfe264b786eca13 (diff) | |
download | nixpkgs-4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50.tar nixpkgs-4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50.tar.gz nixpkgs-4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50.tar.bz2 nixpkgs-4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50.tar.lz nixpkgs-4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50.tar.xz nixpkgs-4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50.tar.zst nixpkgs-4be78f0dd3040627cf88fee2c4c4e7f2b0e4af50.zip |
uwsgi service: redefine PATH envvar
Previously if user had `PATH` variable set we would define several `PATH` variables and trigger a conflict.
-rw-r--r-- | nixos/modules/services/web-servers/uwsgi.nix | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/nixos/modules/services/web-servers/uwsgi.nix b/nixos/modules/services/web-servers/uwsgi.nix index a1cad17336d..d1748e150c3 100644 --- a/nixos/modules/services/web-servers/uwsgi.nix +++ b/nixos/modules/services/web-servers/uwsgi.nix @@ -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 { |