From 484673d59bdd15fb10bdc366f5d8b15fee596b8e Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 30 Jul 2026 15:18:51 +0200 Subject: scripts/{build.sh,update_host.sh}: Make smarter --- scripts/update_hosts.remote | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'scripts/update_hosts.remote') 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 -- cgit v1.3.1