Bootstrapping stand-alone home-manager config with Flakes

Home-manager provides some template for using it with flakes. But there is still no bootstrap/install instructions and manual.

If you already have you config and it includes managing home-manager itself, then you probably can use something like:

nix build --no-write-lock-file home-manager
./result/bin/home-manager --flake ".#$USER" switch

(note that home-manager is in global Flakes registry)

Most likely can use home-manager/release-21.11 if needed (see choosing channel in manual).

If you are not on NixOS and manage nix via home-manager too, you probably want to remove nix installed into nix-env. Just use build instead of switch previously and separately activate it with removal:

nix shell 'nixpkgs#nix' --command sh -c 'nix-env -e nix && ./result/activate'
1 Like

Much more comfortable that running build followed by ./result/bin/home-manager might be the use of nix run.

1 Like
Hosted by Flying Circus.