nixos-manager icon indicating copy to clipboard operation
nixos-manager copied to clipboard

Can't run nixos-manager when home-manager is used within configuration.nix

Open Melkor333 opened this issue 4 years ago • 4 comments

I want to try out nixos-manager, but I can't get it to work. I am on NixOS and have home-manager configured inside my configuration.nix (my configuration is split in multiple files which are imported, if that matters). From what I understand this shouldn't be a problem at all and nixos-manager should be able to run without using the home-manager. But I always get the following message:

# /home/sam/nixos-manager/result/bin/nixos-manager 
Executing: nix search  --json
nixos-manager: /root/.nix-profile/share/doc/home-manager/options.json: openBinaryFile: does not exist (No such file or directory)

This happens with my personal and the root user.

Since I am using home-manager in the NixOS config, I added manual.json.enable = true; to my user config and now I get the following error when trying to run nixos-manager as user (which probably has to do with home-manager not being in the path):

$ /nix/store/32xycr35ajmhqznj3cnmch6r2kdj0567-nixos-manager-1.0/bin/nixos-manager 
Executing: nix search  --json
Executing: home-manager generations
nixos-manager: home-manager: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

I also tried removing home-manager-path from my user env (which probably was a mistake) and since the ~/.nix-profile folder disappeared it went back to the first error.

Does the nixos-manager currently only run with home-manager or is this some kind of bug/current incompatibility with my setup? I also wonder why it isn't in the nixpkgs yet. Is there some reason for that or have you just not yet gotten to creating a PR?

Melkor333 avatar May 18 '20 20:05 Melkor333

Adding the home-manager executable to the PATH is not so trivial since it depends on the home-manager channel. Maybe nixos-manager could bootstrap home-manager itself?

Mic92 avatar May 22 '20 10:05 Mic92

I am a bit confused why nixos-manager needs the home-manager executable in the first place if I have configured everything within /etc/nixos/configuration.nix anyway (or don‘t want to use home-manager at all)?

Melkor333 avatar May 22 '20 13:05 Melkor333

Yes. It should be made optional.

Mic92 avatar May 22 '20 14:05 Mic92

can approve this Problem. I'm on stable 20.03. and like @Melkor333 my nixos and Home-Manager config is split in multiple files.

Executing: nix search  --json
nixos-manager: /home/tk/.nix-profile/share/doc/home-manager/options.json: openBinaryFile: does not exist (No such file or directory)

when setting manuel.json.enable to true, getting

Executing: nix search  --json
Executing: home-manager generations
nixos-manager: home-manager: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

When starting it with nix run nixos.home-manager -c ./nixos-manager, I can get it to work, but I want to configure home-manager only within nixos config, it fails. Since home-manager is not 100% common used in NixOS it should be optional. Also I guess nixos-manager should be helpful to new users and home-manager was not the first thing I wrote to my NixOS config :laughing: (and home-manager is most common configured within config on nixos systems)

tobkratz avatar Jun 17 '20 20:06 tobkratz