aboutsummaryrefslogtreecommitdiff
path: root/nixos-switch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixos-switch.sh')
-rwxr-xr-xnixos-switch.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos-switch.sh b/nixos-switch.sh
new file mode 100755
index 0000000..856acb4
--- /dev/null
+++ b/nixos-switch.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash
+# shellcheck shell=bash
+set -Eeuo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+cat <(echo "${USER_PASSWORD}") <(envsubst < vps-configuration.env.nix) | ssh "$TLD" sudo -S 'cat > /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