Hello, I’m trying to use Nix the package manager to manage the packages and configurations I use on my Macbook so I got started with following this tutorial, but I’m unclear on one thing: I presume that when I run darwin-rebuild, that my state will be replaced with whatever is in flake.nix. Is this true? If so, it’s not clear to me how I can add the current state of my machine (i.e. packages, configs, etc.) to the configuration so I don’t start from scratch once I run the rebuild command.
Alternatively, is this the wrong way to think about it? Should I be starting over with Nix and then building the config through it?
If you have not run darwin-rebuild then the current state of your mac is nothing.
What darwin-rebuild does is update the state from the previous flake.nix to the new flake.nix.
If you have installed applications not through Nix then they will not be changed.
nix-darwin can change your config files e.g. ~/.profile, ~/.bashrc etc and if you put any of them in nix (by enabling shells etc) then your old versions will be overwritten.
So yes I would start over with Nix and build the config through it - however I would use home-manager to do thin gs in your home directory rather than nix-darwin.
nix manages the state of the nix environment and not the state of your machine as there are things outside Nix. (If using nixOS as your Linux distribution then they are the same)