Compare commits

...

2 Commits

Author SHA1 Message Date
Jörg Thalheim
b254962aa8 make flake.nix test pure 2025-11-11 15:39:23 +01:00
Jörg Thalheim
281b49208c hydra-eval-jobs: use nix-eval-jobs's --select rather --expr
the current use of builtins.getFlake, mean we don't have pure evaluation
2025-11-11 15:12:42 +01:00
5 changed files with 26 additions and 19 deletions

View File

@@ -358,21 +358,14 @@ sub evalJobs {
my @cmd; my @cmd;
if (defined $flakeRef) { 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", @cmd = ("nix-eval-jobs",
# Disable the eval cache to prevent SQLite database contention. # Disable the eval cache to prevent SQLite database contention.
# Since Hydra typically evaluates each revision only once, # Since Hydra typically evaluates each revision only once,
# parallel workers would compete for database locks without # parallel workers would compete for database locks without
# providing any benefit from caching. # providing any benefit from caching.
"--option", "eval-cache", "false", "--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 { } else {
my $nixExprInput = $inputInfo->{$nixExprInputName}->[0] my $nixExprInput = $inputInfo->{$nixExprInputName}->[0]
or die "cannot find the input containing the job expression\n"; or die "cannot find the input containing the job expression\n";

View File

@@ -1,4 +1,6 @@
with import ./config.nix; { system ? builtins.currentSystem }:
with import ./config.nix { inherit system; };
{ {
empty_dir = empty_dir =
mkDerivation { mkDerivation {

View File

@@ -1,9 +1,11 @@
{ system ? builtins.currentSystem }:
rec { rec {
path = "@testPath@"; path = "@testPath@";
mkDerivation = args: mkDerivation = args:
derivation ({ derivation ({
system = builtins.currentSystem; inherit system;
PATH = path; PATH = path;
} // args); } // args);
mkContentAddressedDerivation = args: mkDerivation ({ mkContentAddressedDerivation = args: mkDerivation ({

View File

@@ -1,6 +1,11 @@
{ {
outputs = { ... }: { outputs = { self, ... }:
checks = let
import ./basic.nix; 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; }
);
};
} }

View File

@@ -1,6 +1,11 @@
{ {
outputs = { ... }: { outputs = { self, ... }:
hydraJobs = let
import ./basic.nix; 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; }
);
};
} }