launchd: wait for /nix/store before starting agent (#8609)

On Darwin, launchd may attempt to start agents before the Nix store is
mounted and available. This leads to failures when the agent's executable
or arguments reside in the Nix store.

This change wraps the agent's command in a shell script that uses
/bin/wait4path to ensure /nix/store is ready before executing the
original program. It also ensures that ProgramArguments are correctly
escaped and concatenated.
This commit is contained in:
Wael Nasreddine 2026-01-27 21:51:48 -08:00 committed by GitHub
parent ef5da06269
commit eec72f1278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 123 additions and 90 deletions

View file

@ -17,9 +17,9 @@
<string>Background</string>
<key>ProgramArguments</key>
<array>
<string>/some/command</string>
<string>--with-arguments</string>
<string>foo</string>
<string>/bin/sh</string>
<string>-c</string>
<string>/bin/wait4path /nix/store &amp;&amp; exec /some/command --with-arguments foo</string>
</array>
<key>UnrecognizedByHomeManager</key>
<string>should make it to the resulting plist</string>