virtualisation/virtualbox: virtualbox.vmFileName -> image.fileName

This commit is contained in:
phaer 2024-11-15 00:09:13 +01:00
parent b0b3a75676
commit 6cc7449e30

View File

@ -11,6 +11,7 @@ in
{
imports = [
./disk-size-option.nix
../image/file-options.nix
(lib.mkRenamedOptionModuleWith {
sinceRelease = 2411;
from = [
@ -22,6 +23,18 @@ in
"diskSize"
];
})
(lib.mkRenamedOptionModuleWith {
sinceRelease = 2505;
from = [
"virtualisation"
"virtualbox"
"vmFileName"
];
to = [
"image"
"fileName"
];
})
];
options = {
@ -54,13 +67,6 @@ in
The name of the VirtualBox appliance.
'';
};
vmFileName = lib.mkOption {
type = lib.types.str;
default = "nixos-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.ova";
description = ''
The file name of the VirtualBox appliance.
'';
};
params = lib.mkOption {
type =
with lib.types;
@ -207,8 +213,12 @@ in
(lib.mkIf (pkgs.stdenv.hostPlatform.system == "i686-linux") { pae = "on"; })
];
system.nixos.tags = [ "virtualbox" ];
image.extension = "ova";
system.build.image = lib.mkDefault config.system.build.virtualBoxOVA;
system.build.virtualBoxOVA = import ../../lib/make-disk-image.nix {
name = cfg.vmDerivationName;
baseName = config.image.baseName;
inherit pkgs lib config;
partitionTableType = "legacy";
@ -253,7 +263,7 @@ in
echo "exporting VirtualBox VM..."
mkdir -p $out
fn="$out/${cfg.vmFileName}"
fn="$out/${config.image.fileName}"
VBoxManage export "$vmName" --output "$fn" --options manifest ${lib.escapeShellArgs cfg.exportParams}
${cfg.postExportCommands}