Home-manager: Empty env-manifest.nix (after nix-collect-garbage?)

Created on 6 May 2019  路  3Comments  路  Source: nix-community/home-manager

I recently did garbage collected nix (on NixOS) and can no longer switch with home manager (at least, I think this is the problem). build works, but when running home-manager switch I get:

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

/nix/store/akvyj2wbzvmpxgbvlnhaid3lmah7srvh-env-manifest.nix is an empty file, and I get the same error if I attempt to roll back with a previous generation: /nix/store/25d811mvb0ys4w7cd2vhh12r210zf98z-home-manager-generation/activate

It looks to be the same error as #320, but this time I am not building in a VM. I have removed ~/.config/nixpkgs/config.nix and my ~/.config/nixpkgs/home.nix is just:

{ pkgs, lib, config, ... }:

{
  programs.home-manager.enable = true;
}

Should I reinstall home-manager or delete this file? I get nervous whenever I remount /nix/store in rw, but this file does seem problematic.

All 3 comments

Turns out this was a nixpkgs problem with the fix being found in https://github.com/NixOS/nixpkgs/issues/18279 (found via https://github.com/NixOS/nixpkgs/issues/56215). It was my mistake since I am pretty deep in home-manager these days. In short:

nix-env --rollback to switch to the previous version

for a quick fix. Also:

To anyone this happens to (corrupt profile + garbage-collected other profiles), you can delete your corrupt profile. First you might want to remember what was installed:

nix-store -q --references ~/.nix-profile

Then wipe the corrupted profiles out:

sudo rm /nix/var/nix/profiles/per-user/yourname/profile
sudo rm /nix/var/nix/profiles/per-user/yourname/profile-*-link

Then start again from scratch.

Glad it worked out for you! And doubly glad Home Manager wasn't at fault 馃榾

This helped today, I got the same error because of a hard reboot that led to data corruption.

Was this page helpful?
0 / 5 - 0 ratings