2 Commits

Author SHA1 Message Date
John Ericson
9ebc15e709 Upgrade Nix to 2.32 2025-10-20 21:20:16 -04:00
John Ericson
dbae951443 Deduplicate protocol code more with ServeProto::BasicClientConnection
I did this in Nix for this purpose, but didn't get around to actually
taking advantage of it here, until now.
2025-10-20 21:20:16 -04:00
6 changed files with 26 additions and 23 deletions

8
flake.lock generated
View File

@@ -36,16 +36,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1764020296, "lastModified": 1759652726,
"narHash": "sha256-6zddwDs2n+n01l+1TG6PlyokDdXzu/oBmEejcH5L5+A=", "narHash": "sha256-2VjnimOYDRb3DZHyQ2WH2KCouFqYm9h0Rr007Al/WSA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a320ce8e6e2cc6b4397eef214d202a50a4583829", "rev": "06b2985f0cc9eb4318bf607168f4b15af1e5e81d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-25.11-small", "ref": "nixos-25.05-small",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@@ -1,7 +1,7 @@
{ {
description = "A Nix-based continuous build system"; description = "A Nix-based continuous build system";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11-small"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
inputs.nix = { inputs.nix = {
url = "github:NixOS/nix/2.32-maintenance"; url = "github:NixOS/nix/2.32-maintenance";
@@ -59,7 +59,7 @@
manual = forEachSystem (system: let manual = forEachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
hydra = self.packages.${pkgs.stdenv.hostPlatform.system}.hydra; hydra = self.packages.${pkgs.hostPlatform.system}.hydra;
in in
pkgs.runCommand "hydra-manual-${hydra.version}" { } pkgs.runCommand "hydra-manual-${hydra.version}" { }
'' ''

View File

@@ -4,7 +4,7 @@
hydra = { pkgs, lib,... }: { hydra = { pkgs, lib,... }: {
_file = ./default.nix; _file = ./default.nix;
imports = [ ./hydra.nix ]; imports = [ ./hydra.nix ];
services.hydra-dev.package = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.hydra; services.hydra-dev.package = lib.mkDefault self.packages.${pkgs.hostPlatform.system}.hydra;
}; };
hydraTest = { pkgs, ... }: { hydraTest = { pkgs, ... }: {

View File

@@ -31,7 +31,7 @@
, perl , perl
, pixz , pixz
, boost , boost
, postgresql_17 , postgresql_13
, nlohmann_json , nlohmann_json
, prometheus-cpp , prometheus-cpp
@@ -192,7 +192,7 @@ stdenv.mkDerivation (finalAttrs: {
subversion subversion
breezy breezy
openldap openldap
postgresql_17 postgresql_13
pixz pixz
nix-eval-jobs nix-eval-jobs
]; ];

View File

@@ -104,9 +104,9 @@ static void copyClosureTo(
std::unique_lock<std::timed_mutex> sendLock(conn.machine->state->sendLock, std::unique_lock<std::timed_mutex> sendLock(conn.machine->state->sendLock,
std::chrono::seconds(600)); std::chrono::seconds(600));
conn.to << ServeProto::Command::ImportPaths; conn.importPaths(destStore, [&](Sink & sink) {
exportPaths(destStore, missing, conn.to); exportPaths(destStore, missing, sink);
conn.to.flush(); });
if (readInt(conn.from) != 1) if (readInt(conn.from) != 1)
throw Error("remote machine failed to import closure"); throw Error("remote machine failed to import closure");
@@ -301,12 +301,11 @@ static void copyPathFromRemote(
lambda function only gets executed if someone tries to read lambda function only gets executed if someone tries to read
from source2, we will send the command from here rather from source2, we will send the command from here rather
than outside the lambda. */ than outside the lambda. */
conn.to << ServeProto::Command::DumpStorePath << localStore.printStorePath(info.path); conn.narFromPath(localStore, info.path, [&](Source & source) {
conn.to.flush(); TeeSource tee(source, sink);
TeeSource tee(conn.from, sink);
extractNarData(tee, localStore.printStorePath(info.path), narMembers); extractNarData(tee, localStore.printStorePath(info.path), narMembers);
}); });
});
destStore.addToStore(info, *source2, NoRepair, NoCheckSigs); destStore.addToStore(info, *source2, NoRepair, NoCheckSigs);
} }

View File

@@ -18,8 +18,9 @@ tags) from GitHub following a certain naming scheme
=head1 DESCRIPTION =head1 DESCRIPTION
This plugin reads the list of branches or tags using GitHub's REST API. This This plugin reads the list of branches or tags using GitHub's REST API. The name
list is stored in the nix-store and used as an input to declarative jobsets. of the reference must follow a particular prefix. This list is stored in the
nix-store and used as an input to declarative jobsets.
=head1 CONFIGURATION =head1 CONFIGURATION
@@ -33,7 +34,7 @@ The declarative project C<spec.json> file must contains an input such as
"pulls": { "pulls": {
"type": "github_refs", "type": "github_refs",
"value": "[owner] [repo] [type] - [prefix]", "value": "[owner] [repo] heads|tags - [prefix]",
"emailresponsible": false "emailresponsible": false
} }
@@ -41,11 +42,12 @@ In the above snippet, C<[owner]> is the repository owner and C<[repo]> is the
repository name. Also note a literal C<->, which is placed there for the future repository name. Also note a literal C<->, which is placed there for the future
use. use.
C<[type]> is the type of ref to list. Typical values are "heads", "tags", and C<heads|tags> denotes that one of these two is allowed, that is, the third
"pull". "." will include all types. position should hold either the C<heads> or the C<tags> keyword. In case of the former, the plugin
will fetch all branches, while in case of the latter, it will fetch the tags.
C<prefix> denotes the prefix the reference name must start with, in order to be C<prefix> denotes the prefix the reference name must start with, in order to be
included. "." will include all references. included.
For example, C<"value": "nixos hydra heads - release/"> refers to For example, C<"value": "nixos hydra heads - release/"> refers to
L<https://github.com/nixos/hydra> repository, and will fetch all branches that L<https://github.com/nixos/hydra> repository, and will fetch all branches that
@@ -100,6 +102,8 @@ sub fetchInput {
return undef if $input_type ne "github_refs"; return undef if $input_type ne "github_refs";
my ($owner, $repo, $type, $fut, $prefix) = split ' ', $value; my ($owner, $repo, $type, $fut, $prefix) = split ' ', $value;
die "type field is neither 'heads' nor 'tags', but '$type'"
unless $type eq 'heads' or $type eq 'tags';
my $auth = $self->{config}->{github_authorization}->{$owner}; my $auth = $self->{config}->{github_authorization}->{$owner};
my $githubEndpoint = $self->{config}->{github_endpoint} // "https://api.github.com"; my $githubEndpoint = $self->{config}->{github_endpoint} // "https://api.github.com";