Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@
hash = "sha256-eyvz7XbZKUVQZdSVmDmYlHQSCKFE23OeIH4N4hNDg3M=";
};
vendorHash = "sha256-nwNDuE76fVncegDKI/Fztpc30NX8/shNbSfzkrwTPDk=";
# On SIGTERM, Lima's hostagent gracefully powers off the guest and
# waits up to 30s for it to halt (pkg/driver/vz/vz_driver_darwin.go).
# But its autostart plists set no ExitTimeOut, so launchd's 5s default
# SIGKILLs the hostagent when the Mac shuts down --- force-killing the
# guest mid-flush, which corrupts Git repos and drops recent writes.
# Give the graceful stop room to finish (>= the driver's 30s timeout).
patches = (old.patches or [ ]) ++ [ ./lima-exit-timeout.patch ];
});
})
];
Expand Down
24 changes: 24 additions & 0 deletions lima-exit-timeout.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/pkg/autostart/launchd/io.lima-vm.autostart.INSTANCE.plist b/pkg/autostart/launchd/io.lima-vm.autostart.INSTANCE.plist
index 0e777962..15c62d29 100644
--- a/pkg/autostart/launchd/io.lima-vm.autostart.INSTANCE.plist
+++ b/pkg/autostart/launchd/io.lima-vm.autostart.INSTANCE.plist
@@ -25,5 +25,7 @@
<string>{{ .WorkDir }}</string>
<key>ProcessType</key>
<string>Background</string>
+ <key>ExitTimeOut</key>
+ <integer>60</integer>
</dict>
</plist>
diff --git a/pkg/autostart/launchd/io.lima-vm.daemon.INSTANCE.plist b/pkg/autostart/launchd/io.lima-vm.daemon.INSTANCE.plist
index 2da849eb..5af817c9 100644
--- a/pkg/autostart/launchd/io.lima-vm.daemon.INSTANCE.plist
+++ b/pkg/autostart/launchd/io.lima-vm.daemon.INSTANCE.plist
@@ -27,5 +27,7 @@
<string>{{ .WorkDir }}</string>
<key>ProcessType</key>
<string>Background</string>
+ <key>ExitTimeOut</key>
+ <integer>60</integer>
</dict>
</plist>