Help with Home Manager

Hi, still an the learning curve. I have been following the manual and evrything was ok up to section 3.2.
Standalone setup
When I run:

nix run home-manager/master – init --switch
The file /home/dougal/.config/home-manager/home.nix already exists, leaving it unchanged…
Creating /home/dougal/.config/home-manager/flake.nix…

Creating initial Home Manager generation…

error: getting status of ‘/nix/store/j0r21s6dhk71mgvpb2bhm72zlz4hvmk0-source/flake.nix’: No such file or directory
error: getting status of ‘/nix/store/j0r21s6dhk71mgvpb2bhm72zlz4hvmk0-source/flake.nix’: No such file or directory
error: getting status of ‘/nix/store/j0r21s6dhk71mgvpb2bhm72zlz4hvmk0-source/flake.nix’: No such file or directory
Uh oh, the installation failed! Please create an issue at

if the error seems to be the fault of Home Manager.

Yep, I think this is a bug. What’s likely happening is that you already have a home-manager configuration in that directory, and you track it with git.

The flakes support in home-manager detects that this folder exists, but does not yet have a flake.nix, and since you’re using the flakes installation steps it automatically creates a flake.nix in this directory. Then it tries to build a generation… Which fails because flake.nix is not yet recognized as part of your pre-existing git repo, and flakes require all your files to be part of the git index.

The quick fix is using git add on the flake.nix that home-manager created, assuming you want to actually use a flake, and then re-run the command. If the flakification was unintentional, follow chapters 1.1 and 2 instead.

Someone should probably also write a quick issue upstream about this. Either the flake.nix should not be automatically generated, and the setup should fail (with a message like “A home-manger configuration was found, but it is not set up for flakes yet! Prepare it for use with flakes, or use these instructions instead”), or the flake.nix should automatically be added to git/a gitless url should be used for the first profile.

Hi, thanks for replying.
I ran the git add flake.nix and got

nix run home-manager/master – init --switch
error: unrecognised flag ‘–switch’
Try ‘nix --help’ for more information.

Your right this is my second attempt to get home-manager working.
I thought I would try the ‘official’ way. But the manual doesnt say anything about how I should back out of installing home-manager, apart from obvious rollback at boot time.

Looks like your keyboard combined the two -- into a single em-dash.

Copy out exactly:

nix run home-manager/master -- init --switch

Hi, Yes that did it. thanks :slight_smile:

1 Like