summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2021-06-02 13:07:50 +0200
committerMaciej Krüger <mkg20001@gmail.com>2021-06-02 13:28:43 +0200
commit5faa7056f9ee3dc11096742da4d2eda627b6514f (patch)
treeddf1fd16ad3dff37eed6f29b5ff34d23283a7020
parentaa47d87c826d30543e0a528c26e7619e3b1e493a (diff)
downloadnixpkgs-5faa7056f9ee3dc11096742da4d2eda627b6514f.tar
nixpkgs-5faa7056f9ee3dc11096742da4d2eda627b6514f.tar.gz
nixpkgs-5faa7056f9ee3dc11096742da4d2eda627b6514f.tar.bz2
nixpkgs-5faa7056f9ee3dc11096742da4d2eda627b6514f.tar.lz
nixpkgs-5faa7056f9ee3dc11096742da4d2eda627b6514f.tar.xz
nixpkgs-5faa7056f9ee3dc11096742da4d2eda627b6514f.tar.zst
nixpkgs-5faa7056f9ee3dc11096742da4d2eda627b6514f.zip
nixos/virtualbox-image: add exportParams
This allows the user to specify custom export
parameters like adding a vendor to the exported VM
-rw-r--r--nixos/modules/virtualisation/virtualbox-image.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index 071edda8269..272c696807a 100644
--- a/nixos/modules/virtualisation/virtualbox-image.nix
+++ b/nixos/modules/virtualisation/virtualbox-image.nix
@@ -58,7 +58,19 @@ in {
 
           Run <literal>VBoxManage modifyvm --help</literal> to see more options.
         '';
-     };
+      };
+      exportParams = mkOption {
+        type = with types; listOf (oneOf [ str int bool (listOf str) ]);
+        example = [
+          "--vsys" "0" "--vendor" "ACME Inc."
+        ];
+        default = [];
+        description = ''
+          Parameters passed to the Virtualbox export command.
+
+          Run <literal>VBoxManage export --help</literal> to see more options.
+        '';
+      };
       extraDisk = mkOption {
         description = ''
           Optional extra disk/hdd configuration.
@@ -158,7 +170,7 @@ in {
           echo "exporting VirtualBox VM..."
           mkdir -p $out
           fn="$out/${cfg.vmFileName}"
-          VBoxManage export "$vmName" --output "$fn" --options manifest
+          VBoxManage export "$vmName" --output "$fn" --options manifest ${escapeShellArgs cfg.exportParams}
 
           rm -v $diskImage