nixos/virtualbox-image: Allow running extra commands after OVA creation
This is useful as virtual machines can often be large files so not having duplicates/work files in /nix/store can save a lot of space.
This commit is contained in:
parent
0a55d764ac
commit
4009f60d0b
@ -107,6 +107,23 @@ in {
|
||||
};
|
||||
});
|
||||
};
|
||||
postExportCommands = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
${pkgs.cot}/bin/cot edit-hardware "$fn" \
|
||||
-v vmx-14 \
|
||||
--nics 2 \
|
||||
--nic-types VMXNET3 \
|
||||
--nic-names 'Nic name' \
|
||||
--nic-networks 'Nic match' \
|
||||
--network-descriptions 'Nic description' \
|
||||
--scsi-subtypes VirtualSCSI
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Extra commands to run after exporting the OVA to `$fn`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -179,6 +196,7 @@ in {
|
||||
mkdir -p $out
|
||||
fn="$out/${cfg.vmFileName}"
|
||||
VBoxManage export "$vmName" --output "$fn" --options manifest ${escapeShellArgs cfg.exportParams}
|
||||
${cfg.postExportCommands}
|
||||
|
||||
rm -v $diskImage
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user