Linux

Where Does Home Manager Store Config and Generations?

Home Manager centers on ~/.config/home-manager/home.nix, with generations in the Nix store and gcroots guarding them.

Last updated

Home Manager manages a user environment from one config file: home.nix under ~/.config/home-manager (or flake.nix for flake setups). Switching builds a numbered generation into the Nix store, links packages into ~/.nix-profile, and symlinks dotfiles into home.

Generations make mistakes cheap. Each switch is versioned, listed by the generations command, and removable when stale. GC roots under the XDG state dir keep the collector from eating the active environment during routine nix-collect-garbage runs.

Where Home Manager stores this, by platform

Linux
~/.config/home-manager/home.nix

Declares user, packages, and dotfiles plus stateVersion. Flake setups add flake.nix beside it. Old nixpkgs path still works with a warning.

Linux
~/.local/state/home-manager/gcroots

current-home and new-home roots live here, guarding the active generation from garbage collection. Profile links resolve through the Nix store.

Frequently asked questions

How do I move my Home Manager setup to a new machine?

Copy home.nix (and flake files) to the new machine, install Nix and Home Manager, then switch. Packages land in ~/.nix-profile and dotfiles symlink into home.

How do I roll back a bad Home Manager switch?

Run the generations subcommand to list them and remove-generations to prune. Rollback re-activates the previous generation without adding a new one.

Is ~/.config/nixpkgs still valid?

Yes, and the old path still works with a warning. New installs generate the home-manager directory, so prefer it for anything you write today.

Notice an outdated path? Let us know.