From 0fe50a9c62c5bb5ab44be9f1580fa6c7a0ff05ee Mon Sep 17 00:00:00 2001 From: Yureka Date: Fri, 22 Oct 2021 23:25:50 +0200 Subject: [PATCH] wip --- deploy.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/deploy.sh b/deploy.sh index c19b0a8..dfecf08 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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 "" -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"