Skip to content

Commit

Permalink
Upload fallback-paths.nix as part of the release
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Jun 6, 2023
1 parent 2b01e83 commit 42e908a
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions maintainers/upload-release.pl
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,22 @@ sub downloadFile {
system("docker manifest push nixos/nix:latest") == 0 or die;
}

# Upload nix-fallback-paths.nix.
sub getStorePath {
my ($jobName) = @_;
my $buildInfo = decode_json(fetch("$evalUrl/job/$jobName", 'application/json'));
return $buildInfo->{buildoutputs}->{out}->{path} or die "cannot get store path for '$jobName'";
}

write_file("$tmpDir/fallback-paths.nix",
"{\n" .
" x86_64-linux = \"" . getStorePath("build.x86_64-linux") . "\";\n" .
" i686-linux = \"" . getStorePath("build.i686-linux") . "\";\n" .
" aarch64-linux = \"" . getStorePath("build.aarch64-linux") . "\";\n" .
" x86_64-darwin = \"" . getStorePath("build.x86_64-darwin") . "\";\n" .
" aarch64-darwin = \"" . getStorePath("build.aarch64-darwin") . "\";\n" .
"}\n");

# Upload release files to S3.
for my $fn (glob "$tmpDir/*") {
my $name = basename($fn);
Expand All @@ -199,24 +215,6 @@ sub downloadFile {
}
}

# Print new nix-fallback-paths.nix.
if ($isLatest) {
sub getStorePath {
my ($jobName) = @_;
my $buildInfo = decode_json(fetch("$evalUrl/job/$jobName", 'application/json'));
return $buildInfo->{buildoutputs}->{out}->{path} or die "cannot get store path for '$jobName'";
}

print STDERR "nixos/modules/installer/tools/nix-fallback-paths.nix:\n" .
"{\n" .
" x86_64-linux = \"" . getStorePath("build.x86_64-linux") . "\";\n" .
" i686-linux = \"" . getStorePath("build.i686-linux") . "\";\n" .
" aarch64-linux = \"" . getStorePath("build.aarch64-linux") . "\";\n" .
" x86_64-darwin = \"" . getStorePath("build.x86_64-darwin") . "\";\n" .
" aarch64-darwin = \"" . getStorePath("build.aarch64-darwin") . "\";\n" .
"}\n";
}

# Update the "latest" symlink.
$channelsBucket->add_key(
"nix-latest/install", "",
Expand Down

0 comments on commit 42e908a

Please sign in to comment.