From 5986aae704dee6baa3bc0abfc1540bf30395ec52 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Nov 2017 16:12:20 +0100 Subject: [PATCH] Add option eval_substituter When using the "build" or "sysbuild" jobset input types in conjunction with a binary cache store, the evaluator needs to be able to fetch store paths from the binary cache. Typical usage: store_uri = s3://nix-test-cache?secret-key=... eval_substituter = s3://nix-test-cache Also, the public key of the binary cache must be added to binary-cache-public-keys in nix.conf, otherwise the local nix-daemon won't allow the store paths to be copied over. --- src/script/hydra-eval-jobset | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/script/hydra-eval-jobset b/src/script/hydra-eval-jobset index 16d7ae55..4ad0ef98 100755 --- a/src/script/hydra-eval-jobset +++ b/src/script/hydra-eval-jobset @@ -75,6 +75,20 @@ sub attrsToSQL { } +# Fetch a store path from 'eval_substituter' if not already present. +sub getPath { + my ($path) = @_; + return 1 if isValidPath($path); + + my $substituter = $config->{eval_substituter}; + + system("nix", "copy", "--from", $substituter, "--", $path) + if defined $substituter; + + return isValidPath($path); +} + + sub fetchInputBuild { my ($db, $project, $jobset, $name, $value) = @_; @@ -95,7 +109,7 @@ sub fetchInputBuild { , where => \ attrsToSQL($attrs, "me.id") })->single; } - return () if !defined $prevBuild || !isValidPath(getMainOutput($prevBuild)->path); + return () if !defined $prevBuild || !getPath(getMainOutput($prevBuild)->path); #print STDERR "input `", $name, "': using build ", $prevBuild->id, "\n"; @@ -133,7 +147,7 @@ sub fetchInputSystemBuild { my @validBuilds = (); foreach my $build (@latestBuilds) { - push(@validBuilds, $build) if isValidPath(getMainOutput($build)->path); + push(@validBuilds, $build) if getPath(getMainOutput($build)->path); } if (scalar(@validBuilds) == 0) {