From 18e031c82b1b10a77941b24e3e027989d0579930 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Mon, 26 Feb 2024 19:21:26 +0100 Subject: [PATCH] makeDarwinImage: allow not starting the macOS VM automatically On my laptop I want to just start the VM when I need it to conserve battery. --- makeDarwinImage/module.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/makeDarwinImage/module.nix b/makeDarwinImage/module.nix index 635bb57..8ed12fe 100644 --- a/makeDarwinImage/module.nix +++ b/makeDarwinImage/module.nix @@ -97,6 +97,13 @@ in Whether to open the sshPort and vncDisplayNumber on the networking.firewall ''; }; + autoStart = lib.mkOption { + type = lib.types.bool; + default = true; + description = lib.mdDoc '' + Whether to automatically start the VM after booting the host machine. + ''; + }; }; config = let run-macos = cfg.package.makeRunScript { @@ -112,7 +119,7 @@ in rm -f *.qcow2 ''; description = "macOS Ventura"; - wantedBy = [ "multi-user.target" ]; + wantedBy = lib.optionals cfg.autoStart [ "multi-user.target" ]; serviceConfig = { Type = "simple"; ExecStart = "${lib.getExe run-macos}";