Open bjornfor opened 1 year ago
Can you give me an example of what you're supposed to enter there? I'd like to provide:
users:
- name: myUser
password: $myPasswordHash
but I can't figure it out. I tried:
settings = {
users = {
name = "myUser";
password = "$myPasswordHash";
};
but it did not like that.
@sjau: The dash indicates a list element, and your Nix value is an attrset. Try this:
settings = {
users = [
{ name = "myUser"; password = "pass"; }
];
};
Useful for playing around with Nix/YAML conversion:
$ cat $(nix-build -E '((import <nixpkgs> {}).formats.yaml {}).generate "foo" { users = [ { name = "myUser"; password = "pass"; } ]; }')
users:
- name: myUser
password: pass
To be more specific, services.adguardhome.settings
actually compiles to JSON rather than YAML, which adds to the confusion of the type annotation.
@sjau: The dash indicates a list element, and your Nix value is an attrset. Try this:
Yeah, this works, just used:
settings = {
bind_port = 3000;
users = [ {
name = "myUser";
password = "$myHashedPassword";
} ];
};
actually compiles to JSON rather than YAML
JSON is YAML :)
JSON is YAML :)
Exactly. The only difference is that it makes the document, module code and user configuration show three seperate format, to one's first glance.
Describe the bug
Here, an example from
man configuration.nix
:Looking at
Type: YAML value
above, I'd expect to pass a string, but it really does take a Nix attrset (which then gets converted to YAML internally).Expected behavior
I guess I'd like for the type documentation to say it's a Nix value of some sort. Maybe
Nix value, internally converted to <type>
?