nix-darwin: use launchctl asuser now that activation runs as root (#7051)

https://github.com/nix-darwin/nix-darwin/pull/1341#discussion_r1989887502
This commit is contained in:
Michael Hoang 2025-05-16 15:51:29 +10:00 committed by GitHub
parent a1a72d18ee
commit d2263ce5f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,7 @@ in
system.activationScripts.postActivation.text = lib.concatStringsSep "\n" (
lib.mapAttrsToList (username: usercfg: ''
echo Activating home-manager configuration for ${usercfg.home.username}
sudo -u ${usercfg.home.username} --set-home ${pkgs.writeShellScript "activation-${usercfg.home.username}" ''
launchctl asuser "$(id -u ${usercfg.home.username})" sudo -u ${usercfg.home.username} --set-home ${pkgs.writeShellScript "activation-${usercfg.home.username}" ''
${lib.optionalString (
cfg.backupFileExtension != null
) "export HOME_MANAGER_BACKUP_EXT=${lib.escapeShellArg cfg.backupFileExtension}"}