Skip to content

Commit d0d27ad

Browse files
committed
nix-darwin: Find Nix with restrictive sudoers PATH.
If the system has a restrictive default PATH in sudoers, Nix might not be available within the activation script. Since our script sets its own PATH (except for inherting Nix), this should only impact looking up Nix itself.
1 parent e08e6e2 commit d0d27ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nix-darwin/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ in
1919
system.activationScripts.postActivation.text = lib.concatStringsSep "\n" (
2020
lib.mapAttrsToList (username: usercfg: ''
2121
echo Activating home-manager configuration for ${usercfg.home.username}
22-
launchctl asuser "$(id -u ${usercfg.home.username})" sudo -u ${usercfg.home.username} --set-home ${pkgs.writeShellScript "activation-${usercfg.home.username}" ''
22+
launchctl asuser "$(id -u ${usercfg.home.username})" sudo -u ${usercfg.home.username} --preserve-env=PATH --set-home ${pkgs.writeShellScript "activation-${usercfg.home.username}" ''
2323
${lib.optionalString (
2424
cfg.backupFileExtension != null
2525
) "export HOME_MANAGER_BACKUP_EXT=${lib.escapeShellArg cfg.backupFileExtension}"}

0 commit comments

Comments
 (0)