File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 203
203
assert info["revision"] == "${ nixpkgs . rev } ", f"revision mismatch: {info['revision']} != ${ nixpkgs . rev } "
204
204
cat_log()
205
205
206
+ out = client.succeed("nix flake prefetch nixpkgs --json")
207
+ nar_hash = json.loads(out)['hash']
208
+
209
+ # Test build-time fetching of public flakes.
210
+ client.succeed(f'nix build --store /run/store --extra-experimental-features build-time-fetch-tree -L --expr \'derivation {{ name = "source"; builder = "builtin:fetch-tree"; system = "builtin"; __structuredAttrs = true; input = {{ type = "github"; owner = "NixOS"; repo = "nixpkgs"; }}; outputHashMode = "recursive"; outputHash = "{nar_hash}"; }}\' ')
211
+
206
212
# ... otherwise it should use the API
207
213
out = client.succeed("nix flake metadata private-flake --json --access-tokens github.com=ghp_000000000000000000000000000000000000 --tarball-ttl 0 --no-trust-tarballs-from-git-forges")
208
214
print(out)
211
217
assert info["fingerprint"]
212
218
cat_log()
213
219
220
+ client.succeed(f'nix build --store /run/store --extra-experimental-features build-time-fetch-tree --access-tokens github.com=ghp_000000000000000000000000000000000000 -L --expr \'derivation {{ name = "source"; builder = "builtin:fetch-tree"; system = "builtin"; __structuredAttrs = true; input = {{ type = "github"; owner = "fancy-enterprise"; repo = "private-flake"; }}; outputHashMode = "recursive"; outputHash = "{info['locked']['narHash']}"; }}\' ')
221
+
214
222
# Fetching with the resolved URL should produce the same result.
215
223
info2 = json.loads(client.succeed(f"nix flake metadata {info['url']} --json --access-tokens github.com=ghp_000000000000000000000000000000000000 --tarball-ttl 0"))
216
224
print(info["fingerprint"], info2["fingerprint"])
You can’t perform that action at this time.
0 commit comments