-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when using nodes fixed point from a function in an option #94
Comments
Stacktrace
|
First thing you'll want to do with these traces is grep for The top is closes to the problem, so for this trace, it's somewhere in a |
The example with the users.motd is just for a trivial reproducer with as few moving parts as possible. I've managed to reduce the test case further. The crux appears to be exposing the {
"foo" = { ... }: {
config.networking.hostName = "foo";
};
"quux" = { config, lib, ... }: with lib; {
users.motd = config.utils.allNodes.foo.config.networking.hostName;
};
"defaults" = { name, lib, nodes, ... }:
{
options.utils.allNodes = lib.mkOption {
type = lib.types.anything;
readOnly = true;
default = nodes;
};
config = {
boot.loader.grub.devices = ["/dev/sda"];
system.stateVersion = "22.05";
fileSystems."/" =
{ device = "/dev/disk/by-uuid/94dcf2a2-07c2-4095-a6d5-a8249230a04e";
fsType = "ext4";
};
};
};
} |
And for what its worth, I couldn't make heads or tails of the stack trace. If you have any pointers I'm all ears. The specific error usually occurs when you have something like |
What's even weirder, is that {
"foo" = { ... }: {
config.networking.hostName = "foo";
};
"quux" = { config, lib, allNodes, ... }: with lib; {
users.motd = allNodes.foo.config.networking.hostName;
};
"defaults" = { name, lib, nodes, ... }:
{
config = {
_module.args.allNodes = nodes;
boot.loader.grub.devices = ["/dev/sda"];
system.stateVersion = "22.05";
fileSystems."/" =
{ device = "/dev/disk/by-uuid/94dcf2a2-07c2-4095-a6d5-a8249230a04e";
fsType = "ext4";
};
};
};
} works fine. |
So there's some foul interaction with the nodes fixed point and the config fixed point. |
It appears to be related to config merging. The reproducer works if you suppress config merging for --- a/hive.nix
+++ b/hive.nix
@@ -9,7 +9,7 @@
"defaults" = { name, lib, nodes, ... }:
{
options.utils.allNodes = lib.mkOption {
- type = lib.types.anything;
+ type = lib.types.raw;
readOnly = true;
default = nodes;
}; |
When I use a function inside an option definition, which itself refers to other nodes config, I get an inexplicable error
A reproducer can be found at https://github.com/dminuoso/colmena-fixed-point-bug
The text was updated successfully, but these errors were encountered: