update deploy script to support aarch64

This commit is contained in:
Yuka 2021-10-23 00:26:39 +02:00
parent e2efc79686
commit c576495bb2
Signed by: Yuka
GPG key ID: B95AE06334AFF6BA

View file

@ -11,12 +11,16 @@ then
fi
mode="${1:-switch}"
host="nuc"
target="nuc@nuc.c3h"
#host="${2:-nuc}"
#target="${3:-$host.c3h}"
host="${2:-nuc}"
target="${3:-$host.c3h}"
echo "deploying $host to $target"
sleep 1
sources=$(nix-build nix/sources-dir.nix --no-out-link)
set -x
nixos-rebuild "$mode" --target-host "$target" --use-remote-sudo -I $sources -I "nixos-config=$PWD/hosts/$host/configuration.nix"
system_drv=$(nix-instantiate "<nixpkgs/nixos>" -I $sources -I "nixos-config=$PWD/hosts/$host/configuration.nix" | head -n1)
nix-copy-closure --to $target $system_drv
system=$(ssh $target "nix-store --realise $system_drv")
ssh $target "sudo nix-env -p /nix/var/nix/profiles/system -i $system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration $mode"