Merge pull request #1414 from cleverca22/fix-binary-cache

fix nar endpoint for binary cache hosting
This commit is contained in:
Jörg Thalheim 2024-09-20 13:24:47 +02:00 committed by GitHub
commit 73e51b94b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 3 deletions

View File

@ -329,7 +329,7 @@ sub nar :Local :Args(1) {
else { else {
$path = $Nix::Config::storeDir . "/$path"; $path = $Nix::Config::storeDir . "/$path";
gone($c, "Path " . $path . " is no longer available.") unless isValidPath($path); gone($c, "Path " . $path . " is no longer available.") unless $MACHINE_LOCAL_STORE->isValidPath($path);
$c->stash->{current_view} = 'NixNAR'; $c->stash->{current_view} = 'NixNAR';
$c->stash->{storePath} = $path; $c->stash->{storePath} = $path;

View File

@ -92,7 +92,7 @@ sub buildFinished {
my $hash = substr basename($path), 0, 32; my $hash = substr basename($path), 0, 32;
my ($deriver, $narHash, $time, $narSize, $refs) = queryPathInfo($path, 0); my ($deriver, $narHash, $time, $narSize, $refs) = queryPathInfo($path, 0);
my $system; my $system;
if (defined $deriver and isValidPath($deriver)) { if (defined $deriver and $MACHINE_LOCAL_STORE->isValidPath($deriver)) {
$system = derivationFromPath($deriver)->{platform}; $system = derivationFromPath($deriver)->{platform};
} }
foreach my $reference (@{$refs}) { foreach my $reference (@{$refs}) {

View File

@ -46,7 +46,7 @@ sub fetchInput {
$MACHINE_LOCAL_STORE->addTempRoot($cachedInput->storepath) if defined $cachedInput; $MACHINE_LOCAL_STORE->addTempRoot($cachedInput->storepath) if defined $cachedInput;
if (defined $cachedInput && isValidPath($cachedInput->storepath)) { if (defined $cachedInput && $MACHINE_LOCAL_STORE->isValidPath($cachedInput->storepath)) {
$storePath = $cachedInput->storepath; $storePath = $cachedInput->storepath;
$sha256 = $cachedInput->sha256hash; $sha256 = $cachedInput->sha256hash;
} else { } else {

View File

@ -6,6 +6,8 @@ use File::Basename;
use Hydra::Helper::CatalystUtils; use Hydra::Helper::CatalystUtils;
use MIME::Base64; use MIME::Base64;
use Nix::Manifest; use Nix::Manifest;
use Nix::Store;
use Nix::Utils;
use Hydra::Helper::Nix; use Hydra::Helper::Nix;
use base qw/Catalyst::View/; use base qw/Catalyst::View/;