aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/update_hosts.remote
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-30 15:18:51 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-30 15:18:51 +0200
commit484673d59bdd15fb10bdc366f5d8b15fee596b8e (patch)
treee8aa7e9ea8081275790daf8eeab827852e30d509 /scripts/update_hosts.remote
parentmodules: Use namespaces (diff)
downloadnixos-server-484673d59bdd15fb10bdc366f5d8b15fee596b8e.zip
scripts/{build.sh,update_host.sh}: Make smarter
Diffstat (limited to 'scripts/update_hosts.remote')
-rw-r--r--scripts/update_hosts.remote19
1 files changed, 13 insertions, 6 deletions
diff --git a/scripts/update_hosts.remote b/scripts/update_hosts.remote
index 249b24e..7385129 100644
--- a/scripts/update_hosts.remote
+++ b/scripts/update_hosts.remote
@@ -16,6 +16,7 @@ PATH_add() {
}
branch="$1"
+flake_path="${2-""}"
# We don't have access to git by default, so evaluate it here
PATH_add git
@@ -29,13 +30,19 @@ PATH_add lixPackageSets.latest.lix
PATH_add python3
PATH_add nixos-rebuild
-set -x
-cd /etc/nixos
+if [ -z "$flake_path" ]; then
+ set -x
+ cd /etc/nixos
-sudo git fetch --all --prune
-sudo git switch "$branch"
-sudo git pull --rebase
+ sudo git fetch --all --prune
+ sudo git switch "$branch"
+ sudo git pull --rebase
-PYTHONNOUSERSITE='true' sudo --preserve-env=PATH --preserve-env=PYTHONNOUSERSITE ".nixos-rebuild-wrapped" --no-reexec boot
+ flake_path="git+file:/etc/nixos/"
+fi
+
+# we use the unwrapped one, to make sure that we are really using lix (otherwise it might
+# be wrapped with cppnix).
+PYTHONNOUSERSITE='true' sudo --preserve-env=PATH --preserve-env=PYTHONNOUSERSITE ".nixos-rebuild-wrapped" --flake "$flake_path" --no-reexec boot
sudo reboot