From dfa8e35d450e30d14faabfbfbc4adad6fa7c0cbe Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 25 Nov 2026 13:44:09 +0000 Subject: 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. --- layers/nix.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'layers') 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 -- cgit v1.3.1