Hello! I am having trouble assigning the value of one variable to another. Basically, I am trying to configure MPD and the code in my configuration looks like this:
The problem seems to be that I am trying to set services.mpd.user = config.users.users.nick.name, but I have no idea why this is. I am also having trouble reproducing the error message, as I now get
error: cached failure of attribute ‘nixosConfigurations.hermes.config.system.build.toplevel’
when running nixos-rebuild on my configuration flake.
I tried running this with Lix instead of Nix, and instead get an infinite recursion error:
error:
… while calling the 'head' builtin
at /nix/store/5z81la6av4j0ckp0w1949lxiwjyyykks-source/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/store/5z81la6av4j0ckp0w1949lxiwjyyykks-source/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: infinite recursion encountered
at /nix/store/5z81la6av4j0ckp0w1949lxiwjyyykks-source/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
Interestingly, evaluation passes if I remove services.mpd.user.
I ended up doing something really similar to your solution and it fixed my problem. Thanks a lot. Still, it feels a little hacky and inconsistent… maybe it’s a Nix issue.