Skip to content

Commit

Permalink
makeDarwinImage: allow not starting the macOS VM automatically
Browse files Browse the repository at this point in the history
On my laptop I want to just start the VM when I need it to conserve battery.
  • Loading branch information
Luflosi committed Feb 27, 2024
1 parent 62ba30e commit 18e031c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion makeDarwinImage/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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}";
Expand Down

0 comments on commit 18e031c

Please sign in to comment.