From d2263ce5f4c251c0f7608330e8fdb7d1f01f0667 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Fri, 16 May 2025 15:51:29 +1000 Subject: [PATCH] nix-darwin: use `launchctl asuser` now that activation runs as root (#7051) https://github.com/nix-darwin/nix-darwin/pull/1341#discussion_r1989887502 --- 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 7b2b6e6e..bc0e9b60 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -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}"}