From 86ada36e02c35a9d47efc886682bc1bd10bed163 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 20 May 2026 01:42:19 +0000 Subject: [PATCH] build-support/vm: fix unpopulated `debsGrouped` after structuredAttrs refactor debsGrouped was a nested array, like `[ [ drv1 drv2 ] [ drv3 ] ... ]`. that doesn't map to any bash item, so it would live only in the json attrs. the `for component in "${debsGrouped[@]}"; ...` part of buildCommand was thus referring to an unset variable... but the default bash behavior is to treat that as an empty array even with `set -u` so the loop was just doing nothing. instead, flatten the array on the nix side. bash gets something like `("drv1 drv2" "drv3" ...)` and the existing shell code destructures that as expected. verify by building a vm (e.g. `tests.vmTools.buildPatchelfInDebian.diskImage`) and checking the nix-log before and after for `INSTALLING COMPONENT` messages. Co-Authored-By: Stefan Frijters --- pkgs/build-support/vm/default.nix | 2 +- pkgs/build-support/vm/test.nix | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 53cfe9317e28..6be7d9ebb3f4 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -731,7 +731,7 @@ let ; debsFlat = lib.flatten debs; - debsGrouped = debs; + debsGrouped = map toString debs; preVM = createEmptyImage { inherit size fullName; }; diff --git a/pkgs/build-support/vm/test.nix b/pkgs/build-support/vm/test.nix index 3a7adcbd216e..ec27d06cd7b9 100644 --- a/pkgs/build-support/vm/test.nix +++ b/pkgs/build-support/vm/test.nix @@ -2,12 +2,12 @@ hello, patchelf, pcmanfm, + runCommand, stdenv, vmTools, }: let inherit (vmTools) - buildRPM diskImages makeImageTestScript runInLinuxImage @@ -46,6 +46,23 @@ in }) ); + # Sanity check to ensure the dpkg --install commands have run + checkPerlInstalledInDebian = runInLinuxImage ( + runCommand "check-perl" + { + diskImage = diskImages.debian13x86_64; + diskImageFormat = "qcow2"; + memSize = 512; + } + '' + echo Check if perl is present + perl -v + echo Check if perl is installed + dpkg -l | grep 'ii *perl' + mkdir $out + '' + ); + # RPM-based distros testFedora42Image = makeImageTestScript diskImages.fedora42x86_64; testFedora43Image = makeImageTestScript diskImages.fedora43x86_64;