[Nix-dev] How to fix corrupt .drv files in nix store?

Bjørn Forsman bjorn.forsman at gmail.com
Wed Jul 6 13:21:48 CEST 2016


On 5 July 2016 at 17:57, Eelco Dolstra <eelco.dolstra at logicblox.com> wrote:
> Hi,
>
> On 07/05/2016 05:18 PM, Bjørn Forsman wrote:
>> Long version:
>> I wanted to see how atomic and safe a NixOS update process really is,
>> so I abused one of my systems by pulling the rootfs disk from it a
>> number of times duing "nixos-rebuild switch" (trying to simulate a
>> power cut-off at the worst possible time).
>
> This is only safe if you set "sync-before-registering = true" in nix.conf.
> However, that flag is disabled by default because it causes a significant
> slowdown during evaluation (since every file written to the store needs to be
> fsynced separately).
>
>> $ sudo nixos-rebuild -I nixpkgs=. -Q build
>
> Try passing the "--repair" flag to nixos-rebuild.

Both "sync-before-registering" and "--repair" are undocumented :-)

Thanks for the info.

- Bjørn


More information about the nix-dev mailing list