eval.nix: Skip recursive type checking when cross-referencing configs through the nodes argument
This makes evaluation faster especially when `nodes` is heavily used in the configuration (like in my auto-meshing setup). This matches the behavior of Morph.
This commit is contained in:
parent
cdbb69617f
commit
872f944743
1 changed files with 15 additions and 1 deletions
|
@ -445,13 +445,27 @@ let
|
||||||
hive.defaults
|
hive.defaults
|
||||||
] ++ configs ++ (import (npkgs.path + "/nixos/modules/module-list.nix"));
|
] ++ configs ++ (import (npkgs.path + "/nixos/modules/module-list.nix"));
|
||||||
specialArgs = hive.meta.specialArgs // {
|
specialArgs = hive.meta.specialArgs // {
|
||||||
inherit name nodes;
|
inherit name;
|
||||||
|
nodes = uncheckedNodes;
|
||||||
modulesPath = npkgs.path + "/nixos/modules";
|
modulesPath = npkgs.path + "/nixos/modules";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodeNames = filter (name: ! elem name reservedNames) (attrNames hive);
|
nodeNames = filter (name: ! elem name reservedNames) (attrNames hive);
|
||||||
|
|
||||||
|
# Used as the `nodes` argument in modules. We skip recursive type checking
|
||||||
|
# for performance.
|
||||||
|
uncheckedNodes = listToAttrs (map (name: let
|
||||||
|
configs = [
|
||||||
|
{
|
||||||
|
_module.check = false;
|
||||||
|
}
|
||||||
|
] ++ configsFor name;
|
||||||
|
in {
|
||||||
|
inherit name;
|
||||||
|
value = evalNode name configs;
|
||||||
|
}) nodeNames);
|
||||||
|
|
||||||
# Exported attributes
|
# Exported attributes
|
||||||
#
|
#
|
||||||
# Functions are intended to be called with `nix-instantiate --eval --json`
|
# Functions are intended to be called with `nix-instantiate --eval --json`
|
||||||
|
|
Loading…
Reference in a new issue