aboutsummaryrefslogtreecommitdiff
path: root/nixos-switch.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-08-12 22:41:34 -0300
committerEuAndreh <eu@euandre.org>2020-08-12 22:41:34 -0300
commitd4e533667a36df94272f55ab428b2a73356be88a (patch)
tree9ed1bfbe55f69726fc7c8e5bd3656aabeb174ba9 /nixos-switch.sh
parentvps-configuration.env.nix: Finish working Nextcloud installation (diff)
downloadserver-d4e533667a36df94272f55ab428b2a73356be88a.tar.gz
server-d4e533667a36df94272f55ab428b2a73356be88a.tar.xz
Rename: nixos-update.sh->nixos-switch.sh, terraform-update.sh->terraform-apply.sh
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