diff options
author | Robert Kovacsics <robert.kovacsics@cambridgeconsultants.com> | 2022-10-13 17:01:12 +0100 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2023-02-04 07:33:11 +0100 |
commit | 4009f60d0ba7efec0200b1d5f7311693c008c172 (patch) | |
tree | 992e83fbe1808e982c9aaa78f94a79944ce72cb4 | |
parent | 0a55d764ac14ac5e02fa386d5088f12e73f37e36 (diff) | |
download | nixpkgs-4009f60d0ba7efec0200b1d5f7311693c008c172.tar nixpkgs-4009f60d0ba7efec0200b1d5f7311693c008c172.tar.gz nixpkgs-4009f60d0ba7efec0200b1d5f7311693c008c172.tar.bz2 nixpkgs-4009f60d0ba7efec0200b1d5f7311693c008c172.tar.lz nixpkgs-4009f60d0ba7efec0200b1d5f7311693c008c172.tar.xz nixpkgs-4009f60d0ba7efec0200b1d5f7311693c008c172.tar.zst nixpkgs-4009f60d0ba7efec0200b1d5f7311693c008c172.zip |
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.
-rw-r--r-- | nixos/modules/virtualisation/virtualbox-image.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index 2ea23d958cf..407d690e32e 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -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 |