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 <sfrijters@gmail.com>
This commit is contained in:
Colin
2026-05-20 01:42:19 +00:00
parent 4e39fb70d8
commit 86ada36e02
2 changed files with 19 additions and 2 deletions
+1 -1
View File
@@ -731,7 +731,7 @@ let
;
debsFlat = lib.flatten debs;
debsGrouped = debs;
debsGrouped = map toString debs;
preVM = createEmptyImage { inherit size fullName; };
+18 -1
View File
@@ -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;