-
{
options.hosts = mkSubmoduleOptions {
type = types.attrsOf (
...
};
config.flake =
concatMapAttrs (
...
)
config.hosts;
}
# using it:
hosts = {
huananzhi = {
modules = [./hosts/huananzhi/huananzhi.nix];
ipv4 = {
address = "192.168.0.11/28";
gateway = "192.168.0.1";
};
};
}; This causes aforementioned error, however, wrapping it works as expected: {
options.nixos = mkSubmoduleOptions {
hosts = mkOption {
type = types.attrsOf (
...
)
};
};
config.flake =
concatMapAttrs (
...
)
config.nixos.hosts;
}
# using it:
nixos.hosts = {
huananzhi = {
modules = [./hosts/huananzhi/huananzhi.nix];
ipv4 = {
address = "192.168.0.11/28";
gateway = "192.168.0.1";
};
};
}; What am I doing wrong here? |
Beta Was this translation helpful? Give feedback.
Answered by
roberth
Jul 8, 2023
Replies: 1 comment 4 replies
-
options.hosts = mkSubmoduleOptions {
type = types.attrsOf ( That looks a bit like you've put a type where an option is expected, or maybe you didn't copy the line in between. Nothing jumps out to me, so I'd need at least a more complete example and a |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you really need a submodule? I think you could do:
I wonder why this line did not give a proper type error, apparently.
mkSubmoduleOptions
expects a tree of options, as it creates a module from its argument.iWhat error did you get?
That's a whole file, not a reproducible example.