mach-nix/mach_nix/nix/withDot.nix

28 lines
666 B
Nix
Raw Normal View History

2020-10-08 16:58:08 +00:00
{ mkPython, pypiFetcher, ... }:
with builtins;
let
names = pypiFetcher.allNames;
2020-10-11 10:47:40 +00:00
gen = attr: selected:
let
2020-10-11 10:47:40 +00:00
pyEnvBase = mkPython {
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])); }
) names;
2020-10-11 10:47:40 +00:00
drv = if attr == "" then pyEnvBase else pyEnvBase."${attr}";
pyEnv = drv.overrideAttrs (oa: {
passthru =
listToAttrs attrs_list
2020-10-12 03:54:19 +00:00
// { _passthru = pyEnvBase.passthru; };
});
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" [];
}