Skip to content

Commit

Permalink
buildGoModule: be nicer when overrideAttrs clears passthru
Browse files Browse the repository at this point in the history
Before an overlay in the form of:

package.overrideAttrs (old: {
  passthru = {};
})

would fail evaluation like:

       error: attribute 'overrideModAttrs' missing
       at /nix/store/afwc3m1sm49qq57xjv2hmd7iy4x0j33h-source/pkgs/build-support/go/module.nix:179:20:
          178|     outputHashAlgo = if finalAttrs.vendorHash == "" then "sha256" else null;
          179|   }).overrideAttrs finalAttrs.passthru.overrideModAttrs;
             |                    ^
          180|

Now instead we take the fallback default.
  • Loading branch information
SuperSandro2000 committed Sep 2, 2024
1 parent 3dd8490 commit a1cf578
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkgs/build-support/go/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ in
# Handle empty vendorHash; avoid
# error: empty hash requires explicit hash algorithm
outputHashAlgo = if finalAttrs.vendorHash == "" then "sha256" else null;
}).overrideAttrs finalAttrs.passthru.overrideModAttrs;
# in case an overlay clears passthru by accident, don't fail evaluation
}).overrideAttrs (finalAttrs.passthru.overrideModAttrs or overrideModAttrs);

nativeBuildInputs = [ go ] ++ nativeBuildInputs;

Expand Down

0 comments on commit a1cf578

Please sign in to comment.