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:
parent
509ed3c603
commit
6e92bf094d
1 changed files with 6 additions and 1 deletions
|
|
@ -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}"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue