From 58fd2639f7ee23374823a0f91cac87730fb392d1 Mon Sep 17 00:00:00 2001 From: 0xTux <0xtux@pm.me> Date: Tue, 1 Oct 2024 15:18:59 +0530 Subject: [PATCH] add remote build support --- deploy.sh | 11 +++++------ hosts/common/default.nix | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index 85956a2..00e7e6d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,16 +1,15 @@ #!/usr/bin/env bash export NIX_SSHOPTS="-A" -build_remote=false - -hosts="$1" +hostname=$(hostname) +target_hosts="$1" shift -if [ -z "$hosts" ]; then +if [ -z "$target_hosts" ]; then echo "No hosts to deploy" exit 2 fi -for host in ${hosts//,/ }; do - nixos-rebuild --flake .\#$host switch --target-host $host --use-remote-sudo --log-format internal-json -v |& nom --json $@ +for target_host in ${target_hosts//,/ }; do + nixos-rebuild switch --flake .#$target_host --target-host $target_host --build-host $hostname --use-remote-sudo --use-substitutes --log-format internal-json -v $@ done diff --git a/hosts/common/default.nix b/hosts/common/default.nix index ee3d5a1..4f49f45 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -33,6 +33,7 @@ settings = { experimental-features = "nix-command flakes"; auto-optimise-store = true; + trusted-users = ["${username}"]; }; };