2020-10-08 16:58:08 +00:00
|
|
|
{ mkPython, pypiFetcher, ... }:
|
2020-10-07 05:18:02 +00:00
|
|
|
with builtins;
|
|
|
|
let
|
|
|
|
names = pypiFetcher.allNames;
|
2020-10-11 10:47:40 +00:00
|
|
|
gen = attr: selected:
|
2020-10-07 05:18:02 +00:00
|
|
|
let
|
2020-10-11 10:47:40 +00:00
|
|
|
pyEnvBase = mkPython {
|
2020-10-07 05:18:02 +00:00
|
|
|
requirements = foldl' (a: b: a + "\n" + b) "" selected;
|
|
|
|
};
|
|
|
|
attrs_list = map (n:
|
2020-10-11 10:47:40 +00:00
|
|
|
{ name = n; value = (gen attr (selected ++ [n])); }
|
2020-10-07 05:18:02 +00:00
|
|
|
) names;
|
2020-10-11 10:47:40 +00:00
|
|
|
drv = if attr == "" then pyEnvBase else pyEnvBase."${attr}";
|
2020-10-07 05:18:02 +00:00
|
|
|
pyEnv = drv.overrideAttrs (oa: {
|
|
|
|
passthru =
|
|
|
|
listToAttrs attrs_list
|
2020-10-12 03:54:19 +00:00
|
|
|
// { _passthru = pyEnvBase.passthru; };
|
2020-10-07 05:18:02 +00:00
|
|
|
});
|
|
|
|
in
|
|
|
|
pyEnv;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
2020-10-12 03:54:19 +00:00
|
|
|
"pythonWith" = gen "" [];
|
2020-10-11 10:47:40 +00:00
|
|
|
"shellWith" = gen "env" [];
|
|
|
|
"dockerImageWith" = gen "dockerImage" [];
|
2020-10-07 05:18:02 +00:00
|
|
|
}
|