modules/virtualisation: add unified diskSize opt

See https://github.com/NixOS/nixpkgs/pull/339535 and https://github.com/NixOS/nixpkgs/pull/341058
This commit is contained in:
phaer
2024-09-10 19:14:43 +02:00
parent 6071ee8e31
commit c6da9ef32d
14 changed files with 231 additions and 117 deletions

View File

@@ -317,12 +317,11 @@ let
copyChannel = false;
OVMF = cfg.efi.OVMF;
};
in
{
imports = [
../profiles/qemu-guest.nix
./disk-size-option.nix
(mkRenamedOptionModule
[
"virtualisation"
@@ -378,14 +377,6 @@ in
'';
};
virtualisation.diskSize = mkOption {
type = types.ints.positive;
default = 1024;
description = ''
The disk size in megabytes of the virtual machine.
'';
};
virtualisation.diskImage = mkOption {
type = types.nullOr types.str;
default = "./${config.system.name}.qcow2";
@@ -1250,6 +1241,8 @@ in
# override by setting `virtualisation.fileSystems = lib.mkForce { };`.
fileSystems = lib.mkIf (cfg.fileSystems != { }) (mkVMOverride cfg.fileSystems);
virtualisation.diskSizeAutoSupported = false;
virtualisation.fileSystems =
let
mkSharedDir = tag: share: {