From a230d5228d9ea7f52a7e5eae69ffc06932f64758 Mon Sep 17 00:00:00 2001 From: phaer Date: Fri, 15 Nov 2024 00:27:51 +0100 Subject: [PATCH] virtualisation/hyperv-image: hyperv.vmFileName -> image.fileName --- nixos/modules/virtualisation/hyperv-image.nix | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/nixos/modules/virtualisation/hyperv-image.nix b/nixos/modules/virtualisation/hyperv-image.nix index ea0603fa6ae5..8f77d384a9ba 100644 --- a/nixos/modules/virtualisation/hyperv-image.nix +++ b/nixos/modules/virtualisation/hyperv-image.nix @@ -14,6 +14,7 @@ in imports = [ ./disk-size-option.nix + ../image/file-options.nix (lib.mkRenamedOptionModuleWith { sinceRelease = 2411; from = [ @@ -25,6 +26,18 @@ in "diskSize" ]; }) + (lib.mkRenamedOptionModuleWith { + sinceRelease = 2505; + from = [ + "virtualisation" + "hyperv" + "vmFileName" + ]; + to = [ + "image" + "fileName" + ]; + }) ]; options = { @@ -36,13 +49,6 @@ in The name of the derivation for the hyper-v appliance. ''; }; - vmFileName = mkOption { - type = types.str; - default = "nixos-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.vhdx"; - description = '' - The file name of the hyper-v appliance. - ''; - }; }; }; @@ -51,10 +57,14 @@ in # to avoid breaking existing configs using that. virtualisation.diskSize = lib.mkOverride 1490 (4 * 1024); + system.nixos.tags = [ "hyperv" ]; + image.extension = "vhdx"; + system.build.image = config.system.build.hypervImage; system.build.hypervImage = import ../../lib/make-disk-image.nix { name = cfg.vmDerivationName; + baseName = config.image.baseName; postVM = '' - ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=dynamic -O vhdx $diskImage $out/${cfg.vmFileName} + ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=dynamic -O vhdx $diskImage $out/${config.image.fileName} rm $diskImage ''; format = "raw";