Add info about broken derivations and how to fix them

This commit is contained in:
RealStickman 2023-05-04 20:21:57 +02:00
parent fb3ad220c4
commit 510d65c38d

View File

@ -346,6 +346,32 @@ nix-env --delete-generations (gen1) (gen2) # generation gen1 and gen2
nix-env --delete-generations 7d # older than 7 days
```
### "Fixing?" errors about derivations
While trying to rebuild NixOS in a test VM I made, I ran across the following errors:
```
unpacking channels...
this derivation will be built:
/nix/store/xzmcf9zqnk3jlkdk7z80y9f1xwjlh89k-nixos-rebuild.drv
error: getting status of '/nix/store/a9ndjg0b1ivi0av9m93vfkrndp7fqbw1-strip.sh': No such file or directory
building Nix...
error: opening file '/nix/store/6igxs6xrl07pfh7l2lcls4z43b61xpn3-patchelf-0.15.0.drv': No such file or directory
```
Nix seemed to still point to some older paths for some reason.
After some scouring the web, I finally found a post that helped me.
> [File in nix store empty, unable to be repaired](https://discourse.nixos.org/t/file-in-nix-store-empty-unable-to-be-repaired/14497)
From this post I got the following command
```sh
nix-store --verify --check-contents --repair
```
Running the command only once did not resolve all errors, so I just ran it multiple times until it didn't output any errors anymore.
## Automatisms
Automatic upgrades