system.stateVersion option is not defined in your nix-darwin configuration

So I’m a newbie when it comes to Nix. I got inspired to try it (with nix-darwin) from this discussion.

I was able to get it working and it was great. I haven’t updated things in months and now when I go to update and rebuild my system I’m getting

image

In my home.nix, I have

# You can update Home Manager without changing this value. See
    # the Home Manager release notes for a list of state version
    # changes in each release.
    stateVersion = "21.11";

Any suggestions on how to resolve?

The variable needs to go in your nix-darwin configuration, not your Home Manager configuration.

Thanks for the quick response. Sadly, I don’t quite get what exactly is the nix-darwin configuration vs the Home Manager configuration.

Here’s my setup GitHub - philcruz/nixconfig-public If you can clarify where the variable should go that would be highly appreciated.

(I should note this problem pops up when I do nix flake update if I don’t update it works as before.)

It should go in configuration.nix:

          # Main `nix-darwin` config
          ./configuration.nix

The error is from nix-darwin. Home Manager is a separate project with its own module system that happens to integrate with nix-darwin; it has its own stateVersion setting.