From c728307482dacc9b2720b8036292b166c7865fa9 Mon Sep 17 00:00:00 2001 From: midchildan Date: Sat, 5 Nov 2022 12:10:27 +0900 Subject: [PATCH] darwin: use full path to commands in activation script --- modules/launchd/default.nix | 8 ++++---- modules/targets/darwin/user-defaults/default.nix | 6 +++--- tests/modules/targets-darwin/user-defaults.nix | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index 17b36cdb..34fefc17 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -162,12 +162,12 @@ in { fi if [[ -f "$dstPath" ]]; then for (( i = 0; i < bootout_retries; i++ )); do - $DRY_RUN_CMD launchctl bootout "$domain/$agentName" || err=$? + $DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || err=$? if [[ -v DRY_RUN ]]; then break fi if (( err != 9216 )) && - ! launchctl print "$domain/$agentName" &> /dev/null; then + ! /bin/launchctl print "$domain/$agentName" &> /dev/null; then break fi sleep 1 @@ -178,7 +178,7 @@ in { fi fi $DRY_RUN_CMD install -Dm444 -T "$srcPath" "$dstPath" - $DRY_RUN_CMD launchctl bootstrap "$domain" "$dstPath" + $DRY_RUN_CMD /bin/launchctl bootstrap "$domain" "$dstPath" done if [[ ! -e "$oldDir" ]]; then @@ -194,7 +194,7 @@ in { continue fi - $DRY_RUN_CMD launchctl bootout "$domain/$agentName" || : + $DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || : if [[ ! -e "$dstPath" ]]; then continue fi diff --git a/modules/targets/darwin/user-defaults/default.nix b/modules/targets/darwin/user-defaults/default.nix index dfb9b61e..c44d4f9c 100644 --- a/modules/targets/darwin/user-defaults/default.nix +++ b/modules/targets/darwin/user-defaults/default.nix @@ -13,9 +13,9 @@ let cliFlags = lib.optionalString isLocal "-currentHost"; toActivationCmd = domain: attrs: - "$DRY_RUN_CMD defaults ${cliFlags} import ${escapeShellArg domain} ${ - toDefaultsFile domain attrs - }"; + "$DRY_RUN_CMD /usr/bin/defaults ${cliFlags} import ${ + escapeShellArg domain + } ${toDefaultsFile domain attrs}"; nonNullDefaults = mapAttrs (domain: attrs: (filterAttrs (n: v: v != null) attrs)) diff --git a/tests/modules/targets-darwin/user-defaults.nix b/tests/modules/targets-darwin/user-defaults.nix index 26e0656e..bb23f718 100644 --- a/tests/modules/targets-darwin/user-defaults.nix +++ b/tests/modules/targets-darwin/user-defaults.nix @@ -10,9 +10,9 @@ nmt.script = '' assertFileRegex activate \ - "defaults import 'com.apple.desktopservices' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist" + "/usr/bin/defaults import 'com.apple.desktopservices' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist" assertFileRegex activate \ - "defaults -currentHost import 'com.apple.controlcenter' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist" + "/usr/bin/defaults -currentHost import 'com.apple.controlcenter' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist" ''; }; }