Open jheidbrink opened 6 months ago
Nix doesn't fsync
changes to the Nix store by default (see the option sync-before-registering
). So in case of a system crash, manifest.json
can show up as a zero-byte file. You can check for this kind of corruption by doing nix store verify -v ~/.nix-profile
.
Thanks! verify -v ~/.nix-profile
actually confirmed a corrupt store path. Nice to learn about the sync-before-registering
, I'll try this! As far as I understand it, with that option set to false, the possiblity of this kind of corruption is expected and not a bug, right?
Describe the bug
I'm using home-manager modules from within my
configuration.nix
. When runningnixos-rebuild switch
, activating the home-manager environments fails for my two users. When investigating the issue, I found that/nix/var/nix/profiles/per-user/<user>/profile/manifest.json
is an empty file for both users. Older profiles are ok.I cannot use the
nix profile
command to remove the broken profile, becauseSteps To Reproduce
I don't know how to reproduce this. I have experienced system crashes recently, but given that the profiles are in the Nix store, my assumption is that they are built somewhat atomically and hope that system crashes don't lead to half-built derivations in the store.
nix-env --version
outputnix-env (Nix) 2.18.1
Additional context
I have opened an issue in home-manager about this: https://github.com/nix-community/home-manager/issues/5348 - but I guess home-manager simply uses
nix profile
, so it's probably better located here.It seems people encountered empty manifest.json before:
https://github.com/NixOS/nix/issues/4742 https://github.com/NixOS/nixpkgs/issues/18279 https://discourse.nixos.org/t/home-manager-stopped-working-on-my-non-nixos/6023
Priorities
Add :+1: to issues you find important.