Conversation
| module = mkOption { | ||
| description = "the example must be a NixOS module in a file"; | ||
| type = pathInStore; | ||
| type = deferredModule; |
There was a problem hiding this comment.
This must be a path, since we need to render it in documentation. Can't render an expression
There was a problem hiding this comment.
With pathInStore:
nix-repl> :p evaluated-modules.config.projects.Omnom.nixos.services.omnom.examples.base.module
error:
… while evaluating the attribute 'value'
at /nix/store/qmm7hgw60vp7vj9lma95hl329d0j3n6n-source/lib/modules.nix:1084:7:
1083| // {
1084| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1085| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/qmm7hgw60vp7vj9lma95hl329d0j3n6n-source/lib/modules.nix:1084:15:
1083| // {
1084| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1085| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: A definition for option `projects.Omnom.nixos.services.omnom.examples.base.module' is not of type `path in the Nix store'. Definition values:
- In `<unknown-file>': /home/user/ngipkgs/projects/Omnom/example.nixwith deferredModule:
nix-repl> :p evaluated-modules.config.projects.Omnom.nixos.services.omnom.examples.base.module
{
imports = [
{
_file = "<unknown-file>, via option projects.Omnom.nixos.services.omnom.examples.base.module";
imports = [ /home/user/ngipkgs/projects/Omnom/example.nix ];
}
];
}Still, the module isn't being rendered in the overview in both cases, AFAIK.
There was a problem hiding this comment.
What about just path then?
There was a problem hiding this comment.
What about just
paththen?
That works, but it means we can't do something like this anymore
There was a problem hiding this comment.
Hm but that link shows an actual module, not an example
There was a problem hiding this comment.
I meant that by using path all modules will need to be stored in files and we won't be able to declare them like that.
There was a problem hiding this comment.
Yeah and that's alright. We require them as a string in a file for documentation, that's how it is.
01d7f80 to
ccfa1be
Compare
|
To check the module types for a project, run: nix build .#checks.x86_64-linux.projects/<PROJECT_NAME>/nixos/checkFor example: nix build .#checks.x86_64-linux.projects/Omnom/nixos/checkWrong types
metadata = {
summary = "Omnom is a webpage bookmarking and snapshotting service.";
subgrants = [
"omnom"
"omnom-ActivityPub"
123123 # <----
];
}; error: A definition for option `projects.Omnom.metadata.subgrants."[definition 1-entry 3]"' is not of type `string'. Definition values:
- In `<unknown-file>': 123123 examples.base = {
module = ""; # <----
description = "Basic Omnom configuration, mainly used for testing purposes";
tests.basic = null;
}; error: A definition for option `projects.Omnom.nixos.services.omnom.examples.base.module' is not of type `module'. Definition values:
- In `<unknown-file>': ""Missing attributes
examples.base = {
module = ./example.nix;
description = "Basic Omnom configuration, mainly used for testing purposes";
# tests.basic = null; # <----
}; error: The option `projects.Omnom.nixos.services.omnom.examples.base.tests' was accessed but has no value defined. Try setting the option.Extra/Undefined attributes
examples.base = {
module = ./example.nix;
description = "Basic Omnom configuration, mainly used for testing purposes";
tests.basic = null;
hello = "world"; # <----
}; error: The option `projects.Omnom.nixos.services.omnom.examples.base.hello' does not exist. Definition values:
- In `<unknown-file>': "world" |
ccfa1be to
47e0d20
Compare
47e0d20 to
213e064
Compare
7718b9a to
be32e22
Compare
be32e22 to
b5aaf94
Compare
Which will be imported when evaluating the modules
b5aaf94 to
d853be2
Compare
|
I've split off a few fixes to a separate PR and dropped the treewide renaming of |
Ideally, we'd only evaluate the modules without building anything.
Continuation of #991