forked from lix-project/hydra
Merge pull request #722 from grahamc/fix-declarative-jobsets
Fix declarative jobsets due to `nix` command being hidden
This commit is contained in:
commit
e6e4aa54c0
|
@ -193,7 +193,8 @@ sub checkPath {
|
||||||
sub serveFile {
|
sub serveFile {
|
||||||
my ($c, $path) = @_;
|
my ($c, $path) = @_;
|
||||||
|
|
||||||
my $res = run(cmd => ["nix", "ls-store", "--store", getStoreUri(), "--json", "$path"]);
|
my $res = run(cmd => ["nix", "--experimental-features", "nix-command",
|
||||||
|
"ls-store", "--store", getStoreUri(), "--json", "$path"]);
|
||||||
|
|
||||||
if ($res->{status}) {
|
if ($res->{status}) {
|
||||||
notFound($c, "File '$path' does not exist.") if $res->{stderr} =~ /does not exist/;
|
notFound($c, "File '$path' does not exist.") if $res->{stderr} =~ /does not exist/;
|
||||||
|
@ -217,7 +218,8 @@ sub serveFile {
|
||||||
|
|
||||||
elsif ($ls->{type} eq "regular") {
|
elsif ($ls->{type} eq "regular") {
|
||||||
|
|
||||||
$c->stash->{'plain'} = { data => grab(cmd => ["nix", "cat-store", "--store", getStoreUri(), "$path"]) };
|
$c->stash->{'plain'} = { data => grab(cmd => ["nix", "--experimental-features", "nix-command",
|
||||||
|
"cat-store", "--store", getStoreUri(), "$path"]) };
|
||||||
|
|
||||||
# Detect MIME type. Borrowed from Catalyst::Plugin::Static::Simple.
|
# Detect MIME type. Borrowed from Catalyst::Plugin::Static::Simple.
|
||||||
my $type = "text/plain";
|
my $type = "text/plain";
|
||||||
|
|
|
@ -68,8 +68,14 @@ sub handleDeclarativeJobsetBuild {
|
||||||
my $id = $build->id;
|
my $id = $build->id;
|
||||||
die "Declarative jobset build $id failed" unless $build->buildstatus == 0;
|
die "Declarative jobset build $id failed" unless $build->buildstatus == 0;
|
||||||
my $declPath = ($build->buildoutputs)[0]->path;
|
my $declPath = ($build->buildoutputs)[0]->path;
|
||||||
my $declText = readNixFile($declPath)
|
my $declText = eval {
|
||||||
or die "Couldn't read declarative specification file $declPath: $!";
|
readNixFile($declPath)
|
||||||
|
};
|
||||||
|
if ($@) {
|
||||||
|
print STDERR "ERROR: failed to readNixFile $declPath: ", $@, "\n";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
my $declSpec = decode_json($declText);
|
my $declSpec = decode_json($declText);
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
my @kept = keys %$declSpec;
|
my @kept = keys %$declSpec;
|
||||||
|
|
|
@ -509,7 +509,8 @@ sub getStoreUri {
|
||||||
# Read a file from the (possibly remote) nix store
|
# Read a file from the (possibly remote) nix store
|
||||||
sub readNixFile {
|
sub readNixFile {
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
return grab(cmd => ["nix", "cat-store", "--store", getStoreUri(), "$path"]);
|
return grab(cmd => ["nix", "--experimental-features", "nix-command",
|
||||||
|
"cat-store", "--store", getStoreUri(), "$path"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ sub getPath {
|
||||||
|
|
||||||
my $substituter = $config->{eval_substituter};
|
my $substituter = $config->{eval_substituter};
|
||||||
|
|
||||||
system("nix", "copy", "--from", $substituter, "--", $path)
|
system("nix", "--experimental-features", "nix-command", "copy", "--from", $substituter, "--", $path)
|
||||||
if defined $substituter;
|
if defined $substituter;
|
||||||
|
|
||||||
return isValidPath($path);
|
return isValidPath($path);
|
||||||
|
|
Loading…
Reference in a new issue