Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/script/hydra-eval-jobset
Original file line number Diff line number Diff line change
Expand Up @@ -358,21 +358,14 @@ sub evalJobs {
my @cmd;

if (defined $flakeRef) {
my $nix_expr =
"let " .
"flake = builtins.getFlake (toString \"$flakeRef\"); " .
"in " .
"flake.hydraJobs " .
"or flake.checks " .
"or (throw \"flake '$flakeRef' does not provide any Hydra jobs or checks\")";

@cmd = ("nix-eval-jobs",
# Disable the eval cache to prevent SQLite database contention.
# Since Hydra typically evaluates each revision only once,
# parallel workers would compete for database locks without
# providing any benefit from caching.
"--option", "eval-cache", "false",
"--expr", $nix_expr);
"--flake", $flakeRef,
"--select", "flake: flake.outputs.hydraJobs or flake.outputs.checks or (throw \"flake '$flakeRef' does not provide any Hydra jobs or checks\")");
} else {
my $nixExprInput = $inputInfo->{$nixExprInputName}->[0]
or die "cannot find the input containing the job expression\n";
Expand Down
4 changes: 3 additions & 1 deletion t/jobs/basic.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
with import ./config.nix;
{ system ? builtins.currentSystem }:

with import ./config.nix { inherit system; };
{
empty_dir =
mkDerivation {
Expand Down
4 changes: 3 additions & 1 deletion t/jobs/config.nix.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{ system ? builtins.currentSystem }:

rec {
path = "@testPath@";

mkDerivation = args:
derivation ({
system = builtins.currentSystem;
inherit system;
PATH = path;
} // args);
mkContentAddressedDerivation = args: mkDerivation ({
Expand Down
13 changes: 9 additions & 4 deletions t/jobs/flake-checks/flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
outputs = { ... }: {
checks =
import ./basic.nix;
};
outputs = { self, ... }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: builtins.listToAttrs (map (system: { name = system; value = f system; }) systems);
in {
checks = forAllSystems (system:
import ./basic.nix { inherit system; }
);
};
}
13 changes: 9 additions & 4 deletions t/jobs/flake-hydraJobs/flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
outputs = { ... }: {
hydraJobs =
import ./basic.nix;
};
outputs = { self, ... }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: builtins.listToAttrs (map (system: { name = system; value = f system; }) systems);
in {
hydraJobs = forAllSystems (system:
import ./basic.nix { inherit system; }
);
};
}
Loading