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.
(cherry picked from commit eec72f1278)
This patch updates all usage of toPlist such that it escapes any strings
in the final output.
The motication for this change is to avoid confusion when end-users of
home-manager's APIs are not aware that the option values they set end up
being passed un-escaped to XML files.
BREAKING CHANGE: Consumers doing manual escaping will now be doubly escaped.
Co-authored-by: Linnnus <linnnus@users.noreply.github.com>