diff options
author | Ben Sima <ben@bsima.me> | 2025-01-21 05:15:06 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2025-01-21 05:15:06 -0500 |
commit | ef1f2a3caf9f2224bf5dddd04bd0c70e299db5e2 (patch) | |
tree | 877cd245b14f11df62584d1eb46eba75a2350c10 /Omni/Ide | |
parent | e19708a249140d22c8d7a2245c7c11d7b15ef048 (diff) |
Switch inside a systemd-run on push
This guards against network failures that may put the system in an unusable
state. It's included in nixos-rebuild, so I should include it here in some form
too.
https://github.com/NixOS/nixpkgs/pull/258571
Diffstat (limited to 'Omni/Ide')
-rwxr-xr-x | Omni/Ide/push.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Omni/Ide/push.sh b/Omni/Ide/push.sh index e16b26a..5c22e07 100755 --- a/Omni/Ide/push.sh +++ b/Omni/Ide/push.sh @@ -16,5 +16,19 @@ where=$(rg --only-matching --replace '$2' --regexp '(domainname ")(.*)(")' \ "$what/etc/systemd/system/domainname.service") nix copy --to ssh://"$USER"@"$where" "$what" ssh "$USER"@"$where" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what" -ssh "$USER"@"$where" sudo "$what"/bin/switch-to-configuration switch +switch_cmd=( + systemd-run + -E LOCALE_ARCHIVE + --collect + --no-ask-password + --pipe + --quiet + --service-type=exec + --unit=push-switch-to-configuration + --wait + "$what/bin/switch-to-configuration" + "switch" +) +# shellcheck disable=SC2029 +ssh "$USER"@"$where" sudo "${switch_cmd[@]}" echo "${GRN}good: push: $target${NC}" |