mach-nix/mach_nix/nix/withDot.nix
Georges Dubus 746b1f3d7b Fix nix (build|shell) mach-nix#gen
`nix (build|shell) mach-nix#gen` is broken on recent nix versions because
of https://github.com/NixOS/nix/issues/6690.

This commit fixes it by removing `meta` from the list of handled packages.
As a result, nix can access the derivation's meta as expected, and work
as expected.

The side effect is that the `meta` package on pypi cannot be used, but
that's a cost we have to pay.
2022-08-17 11:57:05 +02:00

27 lines
695 B
Nix

{ mkPython, pypiFetcher, ... }:
with builtins;
let
names = pypiFetcher.allNames;
gen = attr: selected:
let
pyEnvBase = mkPython {
requirements = foldl' (a: b: a + "\n" + b) "" selected;
ignoreCollisions = true;
};
attrs_list = map (n:
{ name = n; value = (gen attr (selected ++ [n])); }
) (filter (n: n!= "meta") names);
drv = if attr == "" then pyEnvBase else pyEnvBase."${attr}";
pyEnv = drv.overrideAttrs (oa: {
passthru =
listToAttrs attrs_list
// { _passthru = pyEnvBase.passthru; };
});
in
pyEnv;
in
{
"pythonWith" = gen "" [];
"dockerImageWith" = gen "dockerImage" [];
}