This commit is contained in:
Yuka 2021-10-22 23:25:50 +02:00
parent a52133cec4
commit 0fe50a9c62
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 && /nix/var/nix/profiles/system/bin/switch-to-configuration $mode"