eval.nix: Add meta.specialArgs

This commit is contained in:
Zhaofeng Li 2021-07-16 22:52:23 -07:00
parent 671cf38796
commit 135a42b20f
2 changed files with 28 additions and 1 deletions

View file

@ -72,6 +72,16 @@ let
apply = value: if value == null then null else toString value;
type = types.nullOr types.path;
};
specialArgs = lib.mkOption {
description = ''
A set of special arguments to be passed to NixOS modules.
This will be merged into the `specialArgs` used to evaluate
the NixOS configurations.
'';
default = {};
type = types.attrsOf types.unspecified;
};
};
};
@ -334,7 +344,7 @@ let
hive.defaults
config
] ++ (import (npkgs.path + "/nixos/modules/module-list.nix"));
specialArgs = {
specialArgs = hive.meta.specialArgs // {
inherit name nodes;
modulesPath = npkgs.path + "/nixos/modules";
};

View file

@ -388,3 +388,20 @@ fn test_nixpkgs_config_override() {
vec![ "test".to_string() ]
);
}
#[test]
fn test_meta_special_args() {
TempHive::valid(r#"
{
meta.specialArgs = {
undine = "assimilated";
};
borg = { undine, ... }:
assert undine == "assimilated";
{
boot.isContainer = true;
};
}
"#);
}