blob: 7323a338e0561bde3013c44f5d253f0ce8834673 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#! /usr/bin/env sh
# This is the remote side of `update_hosts.sh`, it will be copied to the remote host
# and is responsible for performing the update.
set -e
PATH_add() {
nix_expr="$1"
what="$(nix build "nixpkgs#$nix_expr.out" --print-out-paths --no-link)"
printf "Adding '%s' (%s/bin) to PATH..\n" "$nix_expr" "$what"
PATH="$what/bin:$PATH"
export PATH
}
branch="$1"
# We don't have access to git by default, so evaluate it here
PATH_add git
# By-default these systems use cppnix, which can't build our config. So let's switch to
# lix.
PATH_add lixPackageSets.latest.lix
# We might or might not have python, and we need it, because we use the unwrapped
# `nixos-update`.
PATH_add python3
PATH_add nixos-rebuild-ng
set -x
cd /etc/nixos
sudo git fetch --all --prune
sudo git switch "$branch"
sudo git pull --rebase
PYTHONNOUSERSITE='true' sudo --preserve-env=PATH --preserve-env=PYTHONNOUSERSITE ".nixos-rebuild-ng-wrapped" --no-reexec boot
sudo reboot
|