Skip to content

Commit e187191

Browse files
committed
nixos-modules/microvm/options: move microvm.qemu.machine default declaration
NixOS/nixos-search#785
1 parent 2a00ca5 commit e187191

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

nixos-modules/microvm/options.nix

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,13 @@ in
400400

401401
qemu.machine = mkOption {
402402
type = types.str;
403-
default = {
404-
x86_64-linux = "microvm";
405-
aarch64-linux = "virt";
406-
}.${pkgs.system};
407403
description = ''
408404
QEMU machine model, eg. `microvm`, or `q35`
409405
410406
Get a full list with `qemu-system-x86_64 -M help`
407+
408+
This has a default declared with `lib.mkDefault` because it
409+
depends on ''${pkgs.system}.
411410
'';
412411
};
413412

@@ -469,4 +468,16 @@ in
469468
defaultText = literalExpression ''"config.microvm.runner.''${config.microvm.hypervisor}"'';
470469
};
471470
};
471+
472+
config = lib.mkMerge [ {
473+
microvm.qemu.machine =
474+
lib.mkIf (pkgs.system == "x86_64-linux") (
475+
lib.mkDefault "microvm"
476+
);
477+
} {
478+
microvm.qemu.machine =
479+
lib.mkIf (pkgs.system == "aarch64-linux") (
480+
lib.mkDefault "virt"
481+
);
482+
} ];
472483
}

0 commit comments

Comments
 (0)