I have a very frustrating issue.
First off I’m a nixos newbie.
Second, an explanation of how I got here:
I was trying to configure Redshift (you know the screen color and brightness tool) and I wanted to create a module that would have some hard-coded values, of my current location (latitude and longitude) so it would be able to be used in my multiple of my system (hosts).
So I would end up using something like:
services.redshift = {
enable = true;
temperature.day = cfg.temperature.day;
temperature.night = cfg.temperature.night;
brightness.day = cfg.brightness.day;
brightness.night = cfg.brightness.night;
extraOptions = [
"-l ${glbInfo.location.latitude}:${glbInfo.location.longitude}"
"-l manual"
];
};
I know that the provided info is not enough on why my attempts to have ${glbInfo.location.XXXX} properly expand, but that is not the issue.
Any attempt to run sudo nixos-rebuild switch --flake .#myhost
would fail with:
...
...
at /nix/store/5acdh8xyry0kdvp6xla2hw7wf3zkphkl-source/lib/attrsets.nix:742:20:
741| then recurse (path ++ [name]) value
742| else f (path ++ [name]) value;
| ^
743| in mapAttrs g;
… while calling anonymous lambda
at /nix/store/5acdh8xyry0kdvp6xla2hw7wf3zkphkl-source/lib/modules.nix:242:72:
241| # For definitions that have an associated option
242| declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
| ^
243|
… while evaluating the option `location.latitude':
error: The option `location.latitude' is used but not defined.
This probably requires another post to figure out why, but again that’s not my question yet.
After giving up, on globally defined these variables, I deleted the module that defined them and redited the redshift file to a plainer:
services.redshift = {
enable = true;
temperature.day = cfg.temperature.day;
temperature.night = cfg.temperature.night;
brightness.day = cfg.brightness.day;
brightness.night = cfg.brightness.night;
extraOptions = [
"-l 40.68:-3.68"
"-l manual"
];
};
I committed the changes to the git repo to make sure that everything is neat, but now trying again to switch to the new version I still get:
… while evaluating the option `location.latitude':
error: The option `location.latitude' is used but not defined.
There is absolutely no mention of location.latitude
or even latitude
in any of my source files.
nixos-rebuild keeps insisting that the “option is used but not defined”
Things I have tried:
- rm -rf ~/.cache/nix
- sudo rm -rf /root/.cache/nix
- nix-garbage-collect
- nix-garbage-collect -d
- sudo nixos-rebuild switch --rollback (thinking maybe if I start from previous version, less things would be cached)
- rebooting multiple times between tries
I just cannot get passed this error.
Not sure if it helps but nix flake check
also fails with the same error.
I’m getting crazy. Help…?