Skip to content

Commit 01a3027

Browse files
authored
Merge pull request #78 from NixOS/nixpkgs-tarball-rework
simplify the tarball lock protocol
2 parents 426c49c + 437ba28 commit 01a3027

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

mirror-nixos-branch.pl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -348,25 +348,16 @@ sub fetch {
348348
my $cache_control = "maxage=600,stale-while-revalidate=1800,public";
349349

350350
sub redirect {
351-
my ($from, $to, $immutable_flake_tarball) = @_;
351+
my ($from, $to) = @_;
352352
$to = "https://releases.nixos.org/" . $to;
353353
print STDERR "redirect $from -> $to\n";
354-
my $object_metadata = { "x-amz-website-redirect-location" => $to, "cache-control" => $cache_control };
355-
if ($immutable_flake_tarball // 0) {
356-
# Optionally sets a header for the "Lockable HTTP Tarball Protocol".
357-
# See <https://github.com/NixOS/nix/blob/61f49de7ae0b3899abdcc102832523153dd40d35/doc/manual/source/protocols/tarball-fetcher.md>.
358-
# AWS S3 does not not allow setting the "Link" header directly.
359-
# Instead, we prefix the header with "x-amz-meta" and let Fastly
360-
# rename the header for us.
361-
$object_metadata->{'x-amz-meta-link'} = "<$to?rev=$rev>; rel=\"immutable\"";
362-
}
363-
$bucketChannels->add_key($from, "", $object_metadata)
354+
$bucketChannels->add_key($from, "", { "x-amz-website-redirect-location" => $to, "cache-control" => $cache_control })
364355
or die $bucketChannels->err . ": " . $bucketChannels->errstr;
365356
}
366357

367358
# Update channels on channels.nixos.org.
368359
redirect($channelName, $releasePrefix);
369-
redirect("$channelName/nixexprs.tar.xz", "$releasePrefix/nixexprs.tar.xz", 1);
360+
redirect("$channelName/nixexprs.tar.xz", "$releasePrefix/nixexprs.tar.xz?rev=$rev");
370361
redirect("$channelName/git-revision", "$releasePrefix/git-revision");
371362
redirect("$channelName/packages.json.br", "$releasePrefix/packages.json.br");
372363
redirect("$channelName/store-paths.xz", "$releasePrefix/store-paths.xz");

0 commit comments

Comments
 (0)