Skip to content

Commit 91c125e

Browse files
committed
fix: use user domain instead of gui for hm sops-nix launchd agent
Using gui/UID domain requires an Aqua GUI session, which is unavailable on headless macOS servers. The user/UID domain is available after any login (SSH or GUI) and works with the Background session type. - Set LimitLoadToSessionType = "Background" in the agent plist - Change activation script domain-target from gui/ to user/
1 parent f140661 commit 91c125e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

modules/home-manager/sops.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,13 @@ in
395395
# Darwin: load secrets once on login
396396
launchd.agents.sops-nix = {
397397
enable = true;
398+
domain = "user";
398399
config = {
399400
Program = script;
400401
EnvironmentVariables = cfg.environment;
401402
KeepAlive = false;
402403
RunAtLoad = true;
404+
LimitLoadToSessionType = "Background";
403405
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/SopsNix/stdout";
404406
StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/SopsNix/stderr";
405407
};
@@ -410,7 +412,7 @@ in
410412
let
411413
darwin =
412414
let
413-
domain-target = "gui/$(id -u ${config.home.username})";
415+
domain-target = "user/$(id -u ${config.home.username})";
414416
in
415417
''
416418
/bin/launchctl bootout ${domain-target}/org.nix-community.home.sops-nix && true

0 commit comments

Comments
 (0)