Home-Manager stopped working on my non-nixOS

Some changes done through the last couple of days now result in this:

$ home-manager switch
error: file 'home-manager/home-manager/home-manager.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)
error: file 'home-manager/home-manager/home-manager.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)
/home/nmelzer/.nix-profile/bin/home-manager: line 115: /tmp/home-manager-build.6l2dWXK7yg/news-info.sh: No such file or directory

Neither rolling back nix-env nor home-manager does make any difference.

I did a channel update on both boxes last thursday, and realized that one box isn’t working anymore yesterday but I didn’t care much and booted into the also installed nixOS.

The other box received its channel update earlier that day (I think) and continued to work, and I did a channel update and a switch yesterday, which itself worked. Though as I wanted to change some settings today, everything broke with the error from above. I can’t simply boot into another OS with this one, as it is a remove VM provided by my employer to work in.

as the error says; there is no home-manager entry in your NIX_PATH or it is invalid.
Try ‘export NIX_PATH=home-manager=/path/to/home-manager:$NIX_PATH’ before your command or you pass the path with -I home-manager=/my/path too

But where should I know where the path is?

home-manager https://github.com/rycee/home-manager/archive/master.tar.gz
nixpkgs https://nixos.org/channels/nixpkgs-unstable

So far nix found everything when available in nix-channel without further manipulation of NIX_PATH

Do you have programs.home-manager.path set anywhere in your configuration?

What does nix eval '(<home-manager>)' say?

Finally, what does grep -A2 'for path' $(which home-manager) say?

Not that I’m aware of.

When I’m at home I’ll provide a link to the config.

Also I’ll check the output of the commands you gave. I have access via SSH to one of the affected hosts.

Config is available at my repo: https://gitlab.com/NobbZ/nix-home-manager-dotfiles

Problematic hosts are delly-arch and vbox-arch.

$ nix eval '(<home-manager>)'
error: file 'home-manager' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:2
$ grep -A2 'for path' $(which home-manager)
    for path in "" \
                "${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home-manager" \
                "$HOME/.nixpkgs/home-manager" ; do

confirming this is now an issue for me as well after doing a nix-channel --update

Arch Linux as me? Or some other non nixOS?

NixOS. After some playing around, I’m now getting:

$ home-manager switch
Starting home manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
error: syntax error, unexpected $end, at /nix/store/ry2b0qwvhdvdlmrrkawj9c6xiy9d6krs-env-manifest.nix:1:1

There are 24 unread and relevant news items.
Read them by running the command 'home-manager news'.

The file is empty.

My nixOS is still working… Did an update just an hour ago…

my issue appears to be with nix-env

[13:50:13] jon@jon-workstation ~/projects/nixpkgs (master)
$ nix-env -iA nixpkgs.hello
error: syntax error, unexpected $end, at /nix/store/ry2b0qwvhdvdlmrrkawj9c6xiy9d6krs-env-manifest.nix:1 

That one works for me, at least on the computer I can access remotely…

After giving this more thaught, during the weekend nixos-activation.service started to fail at my home laptop.

In the error XDG_CONFIG_HOME is mentioned, can this be related? (Sadly I won’t be able to access that computer before todays evening to get the full error message).

Okay, by manually setting NIX_PATH pointing into ~/.nix-defexpr/channels I can make it work at least temporary.

Even though that works as a workaroround, I’d be happy if it would work the same way as before, without having to fiddle with the environment.

$ NIX_PATH=home-manager=${HOME}/.nix-defexpr/channels/home-manager:nixpkgs=${HOME}/.nix-defexpr/channels/nixpkgs home-manager switch

My issue was related to How can I fix a corrupt manifest.nix? · Issue #18279 · NixOS/nixpkgs · GitHub , an empty manifest was causing nix-env to error when running any command.

I have the same issue on a DO Ubuntu 20.04 VPS, nothing seems to be corrupt. I’ve reinstalled Nix a bunch, didn’t try the

Which of the 2 discussed issues do you have?

I was missing home_manager=path:… part in the NIX_PATH!

Pointing to a place on the FS where I cloned home_manager and sourcing .bashrc fixed the issue.

Hey folks,

I faced a similar issue but in my case I was missing the following line from $HOME/.config/home-manager/home.nix:

programs.home-manager.enable = true;

So, basically what was (I think) happenning was home-manager would go set everything up and remove itself because that’s how the state was defined. In a nixOS install, that wouldn’t be an issue because it’s basically a sudo nixos-rebuild switch command for home-manager too.

Disclaimer: might be wrong because I’m new to nixOS and nix in general.