1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-22 22:48:31 +02:00

nix-darwin: sudo --set-home for multiple user activation (#2857)

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
This commit is contained in:
toonn 2022-04-01 17:33:07 +02:00 committed by GitHub
parent cf62e96bf7
commit e1fab012e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"}