From c9cd202a6215af49248916d091e828450fd8a75f Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 26 Nov 2026 16:40:52 +0000 Subject: krops.nix: choose the builder before evaluating --- krops.nix | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/krops.nix b/krops.nix index eafa6c76..94dd9326 100644 --- a/krops.nix +++ b/krops.nix @@ -266,19 +266,6 @@ rec { ${pkgs.populate { source = evalSource; target = evalTarget; force = true; }} export NIX_PATH="$eval_dir" - # - # Evaluate here, keeping the derivation for diff. - # - echo "$name: evaluating..." >&2 - drv=$(nix-instantiate \ - --show-trace \ - --add-root "$host_cache"/roots/"$name".drv \ - --argstr secretDirectory ${q "${target'.path}/secrets"} \ - --attr nixosConfigurations."$name".config.system.build.toplevel \ - '') - # nix-instantiate prints the GC root, a link to the derivation here. - drv=$(readlink -f -- "$drv") - # # Choose the first builder that answers, and note its state. # @@ -308,6 +295,19 @@ rec { set -- $builder_state builder_load=$1 builder_cpus=$2 builder_mem=$3 builder_disk=$4 + # + # Evaluate here, keeping the derivation for diff. + # + echo "$name: evaluating..." >&2 + drv=$(nix-instantiate \ + --show-trace \ + --add-root "$host_cache"/roots/"$name".drv \ + --argstr secretDirectory ${q "${target'.path}/secrets"} \ + --attr nixosConfigurations."$name".config.system.build.toplevel \ + '') + # nix-instantiate prints the GC root, a link to the derivation here. + drv=$(readlink -f -- "$drv") + # # Build on the builder, into its store, with a GC root there for as # long as this script runs, so the system stays until it's copied. -- cgit v1.3.1