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 203203 assert info["revision"] == "${ nixpkgs . rev } ", f"revision mismatch: {info['revision']} != ${ nixpkgs . rev } "
204204 cat_log()
205205
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+
206212 # ... otherwise it should use the API
207213 out = client.succeed("nix flake metadata private-flake --json --access-tokens github.com=ghp_000000000000000000000000000000000000 --tarball-ttl 0 --no-trust-tarballs-from-git-forges")
208214 print(out)
211217 assert info["fingerprint"]
212218 cat_log()
213219
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+
214222 # Fetching with the resolved URL should produce the same result.
215223 info2 = json.loads(client.succeed(f"nix flake metadata {info['url']} --json --access-tokens github.com=ghp_000000000000000000000000000000000000 --tarball-ttl 0"))
216224 print(info["fingerprint"], info2["fingerprint"])
You can’t perform that action at this time.
0 commit comments