From 0bdbdea2e26c984b096f4f7d10e3c88536a980b0 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Fri, 1 Apr 2022 10:31:59 -0700 Subject: [PATCH] nix-darwin: sudo --set-home for multiple user activation (#2857) (#2858) Changing from `sudo -i` to `sudo -s` messes up activation when multiple users are managed. `--set-home` should have similar behavior to `-i` in that the activation script is run from the user's home directory. Fixes #2856 (cherry picked from commit e1fab012e872c129099535b5b535fc2347cfa6f4) Co-authored-by: toonn --- nix-darwin/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index a56b3cdd..007e2de3 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -134,7 +134,7 @@ in system.activationScripts.postActivation.text = concatStringsSep "\n" (mapAttrsToList (username: usercfg: '' echo Activating home-manager configuration for ${username} - sudo -u ${username} -s ${pkgs.writeShellScript "activation-${username}" '' + sudo -u ${username} -s --set-home ${pkgs.writeShellScript "activation-${username}" '' ${lib.optionalString (cfg.backupFileExtension != null) "export HOME_MANAGER_BACKUP_EXT=${lib.escapeShellArg cfg.backupFileExtension}"} ${lib.optionalString cfg.verbose "export VERBOSE=1"}