mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
nix-darwin: pass DRY_RUN to activation
Ensure nix-darwin Home Manager activation preserves DRY_RUN when invoking per-user activation through sudo. Closes #7344
This commit is contained in:
@@ -24,7 +24,12 @@ in
|
||||
in
|
||||
''
|
||||
echo Activating home-manager configuration for ${usercfg.home.username} >&2
|
||||
launchctl asuser "$(id -u ${usercfg.home.username})" sudo -u ${usercfg.home.username} --set-home ${pkgs.writeShellScript "activation-${usercfg.home.username}" ''
|
||||
hmDryRunArgs=()
|
||||
hmParentArgs="$(ps -p "$PPID" -ww -o args= || true)"
|
||||
if [[ -v DRY_RUN || "$hmParentArgs" == *" --dry-run"* ]]; then
|
||||
hmDryRunArgs=(env DRY_RUN=1)
|
||||
fi
|
||||
launchctl asuser "$(id -u ${usercfg.home.username})" sudo -u ${usercfg.home.username} --set-home "''${hmDryRunArgs[@]}" ${pkgs.writeShellScript "activation-${usercfg.home.username}" ''
|
||||
${lib.optionalString (
|
||||
cfg.backupFileExtension != null
|
||||
) "export HOME_MANAGER_BACKUP_EXT=${lib.escapeShellArg cfg.backupFileExtension}"}
|
||||
|
||||
Reference in New Issue
Block a user