$HOME and $USER are not expended in PATH, launchd does not support expending variables.
Services that run as normal user, such as yabai, skhd, are all set in this way, if they try to call commands in $HOME/.nix-profile/bin, they will fail.
In this case, PATH should be expended to /Users/azuwis/.nix-profile/bin:/etc/profiles/per-user/azuwis/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/homebrew/bin before putting in ~/Library/LaunchAgents/org.nixos.test.plist.
Use this nix-darwin module to test:
The generated launchagent
~/Library/LaunchAgents/org.nixos.test.plist
:And check
/tmp/test.log
:$HOME
and$USER
are not expended inPATH
, launchd does not support expending variables.Services that run as normal user, such as yabai, skhd, are all set in this way, if they try to call commands in
$HOME/.nix-profile/bin
, they will fail.In this case, PATH should be expended to
/Users/azuwis/.nix-profile/bin:/etc/profiles/per-user/azuwis/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/homebrew/bin
before putting in~/Library/LaunchAgents/org.nixos.test.plist
.