diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index 22646011d33d..26633731f647 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -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}