diff options
| author | tv <tv@krebsco.de> | 2026-11-25 13:44:09 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-25 13:44:09 +0000 |
| commit | dfa8e35d450e30d14faabfbfbc4adad6fa7c0cbe (patch) | |
| tree | 0049a7d766589f36a450d3b1ac2b026cd1d73837 /layers/nix.nix | |
| parent | 6eb17cb3bf9b9d8e948b7a8cc09d6d51d6f4c373 (diff) | |
layers/nix.nix: nix-load-db fails no more on what --verify can't fix
nix-store --verify removes paths that are gone from the database, but
not those that other valid paths refer to: it reports them, and exits
with an error, which failed nix-load-db, and with it the nix daemon,
so every nix command failed in the guest. Now nix-load-db reports it,
and the guest keeps its nix: a build that needs a missing path fails,
and says why.
Diffstat (limited to 'layers/nix.nix')
| -rw-r--r-- | layers/nix.nix | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/layers/nix.nix b/layers/nix.nix index f4dc07f..68ee2c5 100644 --- a/layers/nix.nix +++ b/layers/nix.nix @@ -110,14 +110,17 @@ in serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; # With a persistent store, paths from an earlier image or host - # store may be gone; --verify removes them from the database. + # store may be gone; --verify removes them from the database. Not + # those that other valid paths refer to, which it reports, and then + # fails, but that's no reason to leave the guest without nix: a build + # needing one of them fails, and says why. script = '' for arg in $(cat /proc/cmdline); do case $arg in fc.registration=*) ${config.nix.package.out}/bin/nix-store --load-db < "''${arg#*=}" esac done - ${config.nix.package.out}/bin/nix-store --verify + ${config.nix.package.out}/bin/nix-store --verify || echo "nix-load-db: nix-store --verify left errors (above)" >&2 ''; }; # The host's nixpkgs, wherever it is (see the run script): no copy |
