fix(darwin): guard launchctl bootstrap on plist existence

During home-manager activation, the bootstrap call can fail if the
LaunchAgent plist hasn't been written yet. Check that the plist file
exists before attempting to load it.
This commit is contained in:
jackschu 2026-02-18 08:54:19 -05:00
parent 2d0cf89b44
commit b6f5735434
No known key found for this signature in database
GPG key ID: 2A0AF30A3BD43ABB

View file

@ -411,10 +411,13 @@ in
darwin =
let
domain-target = "gui/$(id -u ${config.home.username})";
plist = "${config.home.homeDirectory}/Library/LaunchAgents/org.nix-community.home.sops-nix.plist";
in
''
/bin/launchctl bootout ${domain-target}/org.nix-community.home.sops-nix && true
/bin/launchctl bootstrap ${domain-target} ${config.home.homeDirectory}/Library/LaunchAgents/org.nix-community.home.sops-nix.plist
if [[ -f ${plist} ]]; then
/bin/launchctl bootstrap ${domain-target} ${plist}
fi
'';
linux =