nixos/uwsgi: use python.withPackages

This commit is contained in:
Aneesh Agrawal 2018-06-04 00:43:23 -07:00
parent 3e3a9e661d
commit c2ab820d6a

View File

@ -31,9 +31,7 @@ let
inherit python; inherit python;
}; };
penv = python.buildEnv.override { pythonEnv = python.withPackages (c.pythonPackages or (self: []));
extraLibs = (c.pythonPackages or (self: [])) pythonPackages;
};
uwsgiCfg = { uwsgiCfg = {
uwsgi = uwsgi =
@ -42,7 +40,7 @@ let
inherit plugins; inherit plugins;
} // removeAttrs c [ "type" "pythonPackages" ] } // removeAttrs c [ "type" "pythonPackages" ]
// optionalAttrs (python != null) { // optionalAttrs (python != null) {
pythonpath = "${penv}/${python.sitePackages}"; pythonpath = "${pythonEnv}/${python.sitePackages}";
env = env =
# Argh, uwsgi expects list of key-values there instead of a dictionary. # Argh, uwsgi expects list of key-values there instead of a dictionary.
let env' = c.env or []; let env' = c.env or [];
@ -51,7 +49,7 @@ let
then substring (stringLength "PATH=") (stringLength x) x then substring (stringLength "PATH=") (stringLength x) x
else null; else null;
oldPaths = filter (x: x != null) (map getPath env'); oldPaths = filter (x: x != null) (map getPath env');
in env' ++ [ "PATH=${optionalString (oldPaths != []) "${last oldPaths}:"}${penv}/bin" ]; in env' ++ [ "PATH=${optionalString (oldPaths != []) "${last oldPaths}:"}${pythonEnv}/bin" ];
} }
else if c.type == "emperor" else if c.type == "emperor"
then { then {