From eb76b98770601cfd6888240612b68499010f04c1 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sun, 7 Jun 2026 13:25:38 +0800 Subject: [PATCH] tests.overriding: tests-fetchurl: use generated non-zero hashes Don't use zero hashes where the hash is supposed to be non-zero. Don't depend on nix.src.hash as nix.src might be wrapped to accept patches. --- pkgs/test/overriding.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/test/overriding.nix b/pkgs/test/overriding.nix index 2c38c6bf17e8..f0244c530bf4 100644 --- a/pkgs/test/overriding.nix +++ b/pkgs/test/overriding.nix @@ -226,9 +226,11 @@ let tests-fetchurl = let + fakeSha256-1 = genNonzeroFakeHash lib.fakeSha256 "1"; + fakeHash-2 = genNonzeroFakeHash lib.fakeHash "B"; src-with-sha256 = pkgs.fetchurl { url = "https://example.com/source.tar.gz"; - sha256 = lib.fakeSha256; + sha256 = fakeSha256-1; }; in { @@ -240,19 +242,19 @@ let ; }; expected = { - outputHash = lib.fakeSha256; + outputHash = fakeSha256-1; outputHashAlgo = "sha256"; }; }; test-fetchurl-overrideAttrs-hash = { expr = { - inherit (src-with-sha256.overrideAttrs { hash = pkgs.hello.src.hash; }) + inherit (src-with-sha256.overrideAttrs { hash = fakeHash-2; }) outputHash outputHashAlgo ; }; expected = { - outputHash = pkgs.hello.src.hash; + outputHash = fakeHash-2; outputHashAlgo = null; }; };