Remove remaining references to store_mode etc.

This commit is contained in:
Eelco Dolstra
2017-10-18 12:23:07 +02:00
parent cc64e51f75
commit bc60fccf78
7 changed files with 36 additions and 60 deletions

View File

@ -347,8 +347,7 @@ sub approxTableSize {
sub requireLocalStore {
my ($c) = @_;
notFound($c, "Nix channels are not supported by this Hydra server.")
if ($c->config->{store_mode} // "direct") ne "direct";
notFound($c, "Nix channels are not supported by this Hydra server.") if !Hydra::Helper::Nix::isLocalStore();
}

View File

@ -23,7 +23,10 @@ our @EXPORT = qw(
getEvals getMachines
pathIsInsidePrefix
captureStdoutStderr run grab
getTotalShares readNixFile
getTotalShares
getStoreUri
readNixFile
isLocalStore
cancelBuilds restartBuilds);
@ -491,12 +494,22 @@ sub restartBuilds($$) {
}
sub getStoreUri {
my $config = getHydraConfig();
return $config->{'store_uri'} // "auto";
}
# Read a file from the (possibly remote) nix store
sub readNixFile {
my ($path) = @_;
my $config = getHydraConfig();
my $storeUri = $config->{'store_uri'} // "";
return grab(cmd => ["nix", "cat-store", "$path"], env => { NIX_REMOTE => "$storeUri" });
return grab(cmd => ["nix", "cat-store", "--store", getStoreUri(), "$path"]);
}
sub isLocalStore {
my $uri = getStoreUri();
return $uri =~ "^(local|daemon|auto)";
}