This PRs extends the recently merged PR #5616, which expanded the Synching config to allow declarative settings under Linux, such that it also works under Darwin.
To simplify the review process, I left split the PR into several commits for now:
The first five commits perform some minor refactoring tasks of the module code such that parts of it can be reused in the Darwin specific changes.
Commit six implements the actual Darwin specific changes. It does the following:
Update the module's syncthing launchd agent to copy the synching key/certificate before starting syncthing, analogously to the systemd service from the above mentioned PR #5616.
Adds an syncthing-initlaunchd agent (analogously to the systemd service synching-init from the above mentioned PR #5616) that updates the configuration files. Since this must be run after the syncthing service started, we use a WatchPath to coordinate both launchd agents.
The last commit just fixes the formatting according to HM's format tool.
There might be better ways to coordinate the two launchd agents I'm not aware of. But I have had this running flawlessly for over two months now (on four Darwin and two Linux machines sharing various folders).
Fixes #4049 for Darwin systems.
Checklist
[x] Change is backwards compatible.
[x] Code formatted with ./format.
[x] Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.
Description
This PRs extends the recently merged PR #5616, which expanded the Synching config to allow declarative settings under Linux, such that it also works under Darwin.
To simplify the review process, I left split the PR into several commits for now:
syncthing
launchd agent to copy the synching key/certificate before starting syncthing, analogously to the systemd service from the above mentioned PR #5616.syncthing-init
launchd agent (analogously to the systemd servicesynching-init
from the above mentioned PR #5616) that updates the configuration files. Since this must be run after the syncthing service started, we use aWatchPath
to coordinate both launchd agents.format
tool.There might be better ways to coordinate the two launchd agents I'm not aware of. But I have had this running flawlessly for over two months now (on four Darwin and two Linux machines sharing various folders).
Fixes #4049 for Darwin systems.
Checklist
[x] Change is backwards compatible.
[x] Code formatted with
./format
.[x] Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.[ ] Test cases updated/added. See example.
[x] Commit messages are formatted (see commit 6; I'll squash the other commits into it after the review process)
Maintainer CC
@karaolidis (pinging as author of the original (linux-specific) PR #5616) @rycee (maintainer)