Skip to content

buildGoModule: be nicer when overrideAttrs clears passthru#339042

Merged
Mic92 merged 1 commit intoNixOS:masterfrom
SuperSandro2000:225051-follow-up
Sep 3, 2024
Merged

buildGoModule: be nicer when overrideAttrs clears passthru#339042
Mic92 merged 1 commit intoNixOS:masterfrom
SuperSandro2000:225051-follow-up

Conversation

@SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Sep 2, 2024

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.

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

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.
@github-actions github-actions bot added the 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. label Sep 2, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Sep 2, 2024
@Mic92 Mic92 merged commit 0e21bc6 into NixOS:master Sep 3, 2024
@atagen atagen mentioned this pull request Sep 4, 2024
13 tasks
@SuperSandro2000 SuperSandro2000 deleted the 225051-follow-up branch September 4, 2024 07:27
@doronbehar
Copy link
Contributor

Before an overlay in the form of:

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

Just out of curiosity why would you apply that overlay?

@SuperSandro2000
Copy link
Member Author

The complete code puts a static asset into passthru. Since the original package has not passthru, being required to merge it felt unintuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants