diff --git a/tests/nixos/fetchers-substitute.nix b/tests/nixos/fetchers-substitute.nix index dc3bb7c02..5363f8e72 100644 --- a/tests/nixos/fetchers-substitute.nix +++ b/tests/nixos/fetchers-substitute.nix @@ -47,6 +47,7 @@ { nodes }: # python '' import json + import os start_all() @@ -118,9 +119,8 @@ # Get the NAR hash of the unpacked tarball in SRI format path_info_json = substituter.succeed(f"nix path-info --json-format 2 --json {tarball_store_path}").strip() - path_info_dict = json.loads(path_info_json) - # nix path-info returns a dict with store paths as keys - narHash_obj = path_info_dict[tarball_store_path]["narHash"] + path_info_dict = json.loads(path_info_json)["info"] + narHash_obj = path_info_dict[os.path.basename(tarball_store_path)]["narHash"] # Convert from structured format {"algorithm": "sha256", "format": "base16", "hash": "..."} to SRI string tarball_hash_sri = substituter.succeed(f"nix hash convert --to sri {narHash_obj['algorithm']}:{narHash_obj['hash']}").strip() print(f"Tarball NAR hash (SRI): {tarball_hash_sri}")