From 6b7b09fef16c9f90ee782c0d460a5cf8f2eac5cc Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 25 Nov 2026 23:19:58 +0000 Subject: tests: give the VMs a store image of their own The VMs used the host's store through 9p, whose paths their Nix doesn't know, so each scenario collecting garbage deleted every one of them from the VMs' view. In a nested VM, whose store shows the outer host's paths too, that took more than 45 minutes for one scenario. With useNixStoreImage, each VM gets an image of its own closure, which already holds every script the scenarios run (system.extraDependencies), and collecting garbage only looks at that. writableStore keeps the store writable, which qemu-vm.nix otherwise only makes the host's store. --- pkgs/populate/tests/vm.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkgs/populate/tests/vm.nix') diff --git a/pkgs/populate/tests/vm.nix b/pkgs/populate/tests/vm.nix index 55362f9..d99388a 100644 --- a/pkgs/populate/tests/vm.nix +++ b/pkgs/populate/tests/vm.nix @@ -34,6 +34,14 @@ let # The plan refers to all scripts the scenarios run. Being part of the # system, they survive the scenarios collecting garbage. system.extraDependencies = [ plan "${./fixtures.sh}" ]; + # A store of their own, with only their closure, rather than the host's + # store through 9p, whose paths the VMs' Nix doesn't know: collecting + # garbage would delete each of them from the VMs' view, which takes + # longer than the scenarios where the host's store is big and 9p is + # slow, e.g. nested. Writable, which qemu-vm.nix only makes the store + # by default if it's the host's. + virtualisation.useNixStoreImage = true; + virtualisation.writableStore = true; nix.settings.substituters = lib.mkForce []; environment.systemPackages = [ pkgs.git -- cgit v1.3.1