1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 10:11:47 +02:00

Merge pull request #10216 from edolstra/fix-github-test

Fix GitHub test
This commit is contained in:
Théophane Hufschmitt 2024-03-11 09:50:33 +01:00 committed by GitHub
commit 83460fb64f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View file

@ -98,6 +98,10 @@ struct GitArchiveInputScheme : InputScheme
if (ref) input.attrs.insert_or_assign("ref", *ref); if (ref) input.attrs.insert_or_assign("ref", *ref);
if (host_url) input.attrs.insert_or_assign("host", *host_url); if (host_url) input.attrs.insert_or_assign("host", *host_url);
auto narHash = url.query.find("narHash");
if (narHash != url.query.end())
input.attrs.insert_or_assign("narHash", narHash->second);
return input; return input;
} }
@ -135,10 +139,13 @@ struct GitArchiveInputScheme : InputScheme
assert(!(ref && rev)); assert(!(ref && rev));
if (ref) path += "/" + *ref; if (ref) path += "/" + *ref;
if (rev) path += "/" + rev->to_string(HashFormat::Base16, false); if (rev) path += "/" + rev->to_string(HashFormat::Base16, false);
return ParsedURL { auto url = ParsedURL {
.scheme = std::string { schemeName() }, .scheme = std::string { schemeName() },
.path = path, .path = path,
}; };
if (auto narHash = input.getNarHash())
url.query.insert_or_assign("narHash", narHash->to_string(HashFormat::SRI, true));
return url;
} }
Input applyOverrides( Input applyOverrides(

View file

@ -58,7 +58,7 @@ let
mkdir -p $out/{commits,tarball} mkdir -p $out/{commits,tarball}
# Setup https://docs.github.com/en/rest/commits/commits#get-a-commit # Setup https://docs.github.com/en/rest/commits/commits#get-a-commit
echo '{"sha": "${private-flake-rev}"}' > $out/commits/HEAD echo '{"sha": "${private-flake-rev}", "commit": {"tree": {"sha": "ffffffffffffffffffffffffffffffffffffffff"}}}' > $out/commits/HEAD
# Setup tarball download via API # Setup tarball download via API
dir=private-flake dir=private-flake
@ -72,7 +72,7 @@ let
mkdir -p $out/commits mkdir -p $out/commits
# Setup https://docs.github.com/en/rest/commits/commits#get-a-commit # Setup https://docs.github.com/en/rest/commits/commits#get-a-commit
echo '{"sha": "${nixpkgs.rev}"}' > $out/commits/HEAD echo '{"sha": "${nixpkgs.rev}", "commit": {"tree": {"sha": "ffffffffffffffffffffffffffffffffffffffff"}}}' > $out/commits/HEAD
''; '';
archive = pkgs.runCommand "nixpkgs-flake" {} archive = pkgs.runCommand "nixpkgs-flake" {}