makeDiskImage: add extraPostVM arg

This commit is contained in:
lassulus 2023-07-28 13:23:23 +02:00 committed by mergify[bot]
parent 8edfd2295c
commit 5e253d949f

View File

@ -3,6 +3,7 @@
, pkgs ? nixosConfig.pkgs , pkgs ? nixosConfig.pkgs
, lib ? pkgs.lib , lib ? pkgs.lib
, name ? "${nixosConfig.config.networking.hostName}-disko-images" , name ? "${nixosConfig.config.networking.hostName}-disko-images"
, extraPostVM ? ""
}: }:
let let
cleanedConfig = diskoLib.testLib.prepareDiskoConfig nixosConfig.config diskoLib.testLib.devices; cleanedConfig = diskoLib.testLib.prepareDiskoConfig nixosConfig.config diskoLib.testLib.devices;
@ -27,6 +28,7 @@ pkgs.vmTools.runInLinuxVM (pkgs.runCommand name {
postVM = '' postVM = ''
mkdir -p $out mkdir -p $out
${lib.concatMapStringsSep "\n" (disk: "cp ${disk.name}.raw $out/${disk.name}.raw") (lib.attrValues nixosConfig.config.disko.devices.disk)} ${lib.concatMapStringsSep "\n" (disk: "cp ${disk.name}.raw $out/${disk.name}.raw") (lib.attrValues nixosConfig.config.disko.devices.disk)}
${extraPostVM}
''; '';
QEMU_OPTS = lib.concatMapStringsSep " " (disk: "-drive file=${disk.name}.raw,if=virtio,cache=unsafe,werror=report") (lib.attrValues nixosConfig.config.disko.devices.disk); QEMU_OPTS = lib.concatMapStringsSep " " (disk: "-drive file=${disk.name}.raw,if=virtio,cache=unsafe,werror=report") (lib.attrValues nixosConfig.config.disko.devices.disk);