diff options
author | Ben Sima <ben@bsima.me> | 2024-05-20 23:15:31 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2024-05-20 23:15:31 -0400 |
commit | 8bb463db7e232bc507d82d602a92cb752c873d79 (patch) | |
tree | 2857ee7b2db73d6c814c5ad4a085c95ae7bc7b61 /Biz/Ide | |
parent | 81108da4b9efb5e2699b9b4167e13d695be8e4d3 (diff) |
Fix push.sh, act as $USER instead of root
At some point I guess the activation script changed to no longer include the
domain, so I have to get it form the 'domainname' systemd service.
Also I switched to sshing as $USER instead of root, which just seems like better
security practice. I originally used root because I thought you had to be root
to do nix system stuff, but it turns out that's not the case.
Diffstat (limited to 'Biz/Ide')
-rwxr-xr-x | Biz/Ide/push.sh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Biz/Ide/push.sh b/Biz/Ide/push.sh index 6729c2f..43dff28 100755 --- a/Biz/Ide/push.sh +++ b/Biz/Ide/push.sh @@ -10,10 +10,11 @@ else target="$prefix.$1" fi what=$(realpath "${CODEROOT:?}/_/nix/$target") -# hack: get the domain from the activation script. there does not seem -# to be a way to get it from nix-instantiate -where=$(rg -r '$2' -e '(domainname ")(.*)(")' "$what/activate") -nix copy --to ssh://root@"$where" "$what" -ssh root@"$where" "$what"/bin/switch-to-configuration switch -ssh root@"$where" nix-env --profile /nix/var/nix/profiles/system --set "$what" +# hack: get the domain from the systemd service. there does not seem to be a way +# to get it from nix-instantiate. (or, maybe i should put this in bild --plan?) +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 "$what"/bin/switch-to-configuration switch +ssh "$USER"@"$where" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what" echo "${GRN}good: push: $target${NC}" |