Installing home-manager from home-manager channel

I am running nix 2.2.2 in Ubuntu 18.04 and I am trying to get home-manager installed with:

$ nix-channel --add home-manager
$ nix-channel --update
$ nix-shell '<home-manager>' -A install -I $HOME/.nix-defexpr/channels 

I get the error:

/nix/store/kpa5ygpxfnsclyhs99znwva35f41ahns-home-manager/bin/home-manager: line 86: nix-build: command not found
/nix/store/kpa5ygpxfnsclyhs99znwva35f41ahns-home-manager/bin/home-manager: line 86: nix-build: command not found
/nix/store/kpa5ygpxfnsclyhs99znwva35f41ahns-home-manager/bin/home-manager: line 99: /run/user/1000/home-manager-build.1NJcaaYm7c/ No such file or directory

When I run:
nix run nixpkgs.home-manager -c home-manager switch

Installs it, but I would prefer having it installed as described in the github page (GitHub - nix-community/home-manager: Manage a user environment using Nix [maintainer=@rycee]).

More context:

  • I am running fishshell and I also tried it in zsh and same error.
  • My nix-channels:
➜ nix-channel --list

What am I doing wrong? (really hope it’s not fishell)

I don’t have much insight to offer on your errors, but I can confirm that home-manager works totally fine with Fish on OSX and NixOS, so I think/hope that’s not the culprit.

Is nix-build in PATH? For example, can you run nix-build --version?

➜ echo $PATH
/home/mandla/.nix-profile/bin /home/mandla/.fzf/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /home/mandla/.bin /home/mandla/.local/bin /home/mandla/.screenlayout /home/mandla/Projects/scripts /home/mandla/.nix-profile/bin


➜ nix-build --version
nix-build (Nix) 2.2.2

Running the script directly: /nix/store/kpa5ygpxfnsclyhs99znwva35f41ahns-home-manager/bin/home-manager shows the help text. I am now going through the nix-shell man page to find clues.

I hope so too, I just started using fishshell seriously like Monday and would hate that it is the culprit :slight_smile:

Quite curious. Did you find out what the issue was?

I haven’t had a change to investigate it further. I simply installed it with

nix run nixpkgs.home-manager -c home-manager switch

I’ll probably look into it if/when this breaks.

Hi, just chiming in that I have the exact same issue.

I still don’t know what caused the issue before. I actually installed Ubuntu 20.04 from scratch a couple of weeks ago and using:

$ nix-channel --add home-manager
$ nix-channel --update
$ nix-shell '<home-manager>' -A install

Worked fine. Turns out I still have way to many things configured and installed manually, but I got some of them down atleast.

Sorry, I can’t help.

I just ran into this today. home-manager switch and home-manager build both fail with a message about a missing “” file.

I thought I had recovered by uninstalling and reinstalling home-manager: home-manager uninstall; nix-shell '<home-manager>' -A install. Unfortunately, a subsequent home-manager switch still failed.

What I actually had to do was revert a recent change to home.nix: I’d attempted to use ${home.homeDirectory} as part of an option’s value. Since home.homeDirectory was being set within the same Nix “set” {...} and I wasn’t using rec {...}, home.homeDirectory didn’t actually have the intended value in this context. I’m not sure how this led to the error, but simply removing ${home.homeDirectory} from that option’s value allows home-manager switch to succeed.

Narrowing it down just a little more, I tried adding ${home.homeDirectory} to an innocuous part of an unrelated option’s multi-line value and home-manager switch failed the same way again.

You probably want to use ${config.home.homeDirectory} where config comes from the module argument (typically at the top of the file).

1 Like