From daab39063fb0057b356834f3bfc41b2275ca7786 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 29 Dec 2023 21:45:14 +0000 Subject: [PATCH] build-support/go: fix eval of `vendorSha256` accesses Before the change there was no way to poll for presence of `vendorSha256` attribute: $ nix-instantiate --strict --eval --expr 'with import ./. {}; _3mux.vendorSha256 or "no hash"' error: attribute 'vendorSha256' missing 292| passthru = passthru // { inherit go goModules vendorHash; } // { inherit (args') vendorSha256; }; | ^ After the change the poll happens as expected: $ nix-instantiate --strict --eval --expr 'with import ./. {}; _3mux.vendorSha256 or "no hash"' "no hash" (cherry picked from commit a1422a7f8f12b68e307b92b7daa254f412e9ff96) --- pkgs/build-support/go/module.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix index d0fd8928c91ab8..2fb59c63482905 100644 --- a/pkgs/build-support/go/module.nix +++ b/pkgs/build-support/go/module.nix @@ -289,7 +289,8 @@ let disallowedReferences = lib.optional (!allowGoReference) go; - passthru = passthru // { inherit go goModules vendorHash; } // { inherit (args') vendorSha256; }; + passthru = passthru // { inherit go goModules vendorHash; } + // lib.optionalAttrs (args' ? vendorSha256 ) { inherit (args') vendorSha256; }; meta = { # Add default meta information