#!/usr/bin/env nix-shell #!nix-shell -i bash # shellcheck shell=bash set -Eeuo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" USER_PASSWORD="$(cat ./secrets/user-password.txt)" # Copy secrets, support files and configuration files rsync -avzP secrets/passwords/ "${TLD}:/data/secrets/" envsubst < envsubst-configuration.nix | ssh "$TLD" 'cat > /data/nixos/envsubst-configuration.nix' ssh "${TLD}" rm -rf "/data/favicons/" rsync -avzP favicons/ "${TLD}:/data/favicons/" scp cgit-about.html "${TLD}:/data/git/about.html" scp ci-gen-index.sh "${TLD}:/data/static/ci-logs/ci-gen-index.sh" scp bash-profile.sh "${TLD}:.bash_profile" # Run nixos-rebuild scp vps-configuration.nix "${TLD}:/etc/nixos/configuration.nix" echo "${USER_PASSWORD}" | ssh "$TLD" sudo -S nix-channel --add "https://nixos.org/channels/nixos-${SYSTEM_STATE_VERSION}" nixos echo "${USER_PASSWORD}" | ssh "$TLD" sudo -S -i nixos-rebuild switch --upgrade