fix(module): explicitly set defaultText to literal#202
fix(module): explicitly set defaultText to literal#202water-sucks merged 1 commit intonix-community:mainfrom
defaultText to literal#202Conversation
... as evaluating the default value depends on `config`.
water-sucks
left a comment
There was a problem hiding this comment.
LGTM, but I have not been able to reproduce this issue. Can you please file an issue report with more information on the eval failure along with a minimal reproducible example? I don't know why config.documentation would be missing.
|
I have encountered the problem after simply adding programs.nixos-cli = {
enable = true;
config = {
# Whatever settings desired.
}
};but I will try to create a MRE to ensure this was not caused by any of my existing configuration. |
|
All good, I want to make sure that |
|
Hello @water-sucks, I was able to create a MRE with the help of Claude: {
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
outputs = { nixpkgs, ... }: {
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
# this is important
documentation.nixos.includeAllModules = true;
# boilerplate
boot.loader.grub.device = "/dev/sda";
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
system.stateVersion = "25.11";
}
({ config, lib, ... }: {
options.test.foo = lib.mkOption {
type = lib.types.bool;
default = config.documentation.nixos.enable;
description = "triggers the bug";
};
})
];
};
};
}Running errorAnd here's the explanation Claude gave me:
So it seems using
But in any case, whenever default references |
|
Whoa! That's quite deep into the builtin documentation generation system you had to dive into, super thankful for the time that you took on this. This actually does have implications for the way Unfortunately, there isn't much I can do about upstream modules failing to eval in the option list generator like this, but I recently added a way for users to exclude options from this list in #183, which is probably the most I can do to prevent eval failures for users. |
... as evaluating the default value depends on
config.https://nixos.org/manual/nixpkgs/stable/#function-library-lib.options.literalExpression
Without this using the nixos module was not possible: