Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildMavenPackage: Add overrideMavenAttrs function and buildOffline documentation #313152

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

tricktron
Copy link
Member

Description of changes

This pr does the following:

  • Adds a overrideMavenAttrs function to make it possible to override attributes of the buildMavenPackage function.
  • Documents the overrideMavenAttrs function.
  • Documents the use case of the buildOffline = true argument for the buildMavenPackage function.

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.05 Release Notes (or backporting 23.05 and 23.11 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.

@github-actions github-actions bot added the 8.has: documentation This PR adds or changes documentation label May 20, 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 May 20, 2024
@tricktron tricktron requested a review from wegank May 20, 2024 16:15
@tricktron
Copy link
Member Author

@ofborg build lemminx dbeaver java-language-server h2 scenebuilder schemaspy

Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed at #ZurichZHF

@tricktron
Copy link
Member Author

@roberth Any idea on how to make this work with finalAttrs?
E.g.

jd-cli.overrideMavenAttrs (finalAttrs: old: rec {
...

@roberth
Copy link
Member

roberth commented Jun 12, 2024

@roberth Any idea on how to make this work with finalAttrs? E.g.

jd-cli.overrideMavenAttrs (finalAttrs: old: rec {
...

I'm not 100% sure what it should mean, and while it could be done, the "architecture" - functions composed in sequence, but made overridable - does not make this easy, and requires that the logic to make that work have knowledge about all other relevant overriding functions, such as overrideAttrs or even others introduced via passthru.
For this reason I'm proposing to change the architecture in

I'm sure you could make it work for limited use cases, e.g. initially not supporting overrideMavenAttrs after overrideAttrs has been called; I just think effort is better spent on solving the root of the problem.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 4, 2024
@tricktron tricktron force-pushed the override-maven-attrs branch from 4e613d3 to e2d1c01 Compare August 2, 2024 02:59
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Aug 2, 2024
@tricktron tricktron force-pushed the override-maven-attrs branch from e2d1c01 to a91a5b5 Compare November 23, 2024 13:22
@github-actions github-actions bot removed 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Nov 23, 2024
@tricktron tricktron force-pushed the override-maven-attrs branch 6 times, most recently from 9eddd45 to b6b7208 Compare November 23, 2024 14:29
@tricktron tricktron force-pushed the override-maven-attrs branch from b6b7208 to cbb3cec Compare November 23, 2024 14:41
@tricktron
Copy link
Member Author

@roberth @fricklerhandwerk I cleaned up the pr for you guys. Unfortunately, I cannot attend the second ZHF day, so I won't be onsite for more interesting discussions.

@tomodachi94
Copy link
Member

This is interesting. I'm generally not opposed to this, but I think the plan should be to eventually remove buildMavenPackage in favor of setup hooks. @NixOS/java: thoughts?

@tomodachi94
Copy link
Member

tomodachi94 commented Nov 23, 2024

Also, @tricktron and company: It would be awesome to see you in #jvm:nixos.org if you're interested in helping maintain the Nixpkgs Java ecosystem at all 🙂

@tricktron
Copy link
Member Author

This is interesting. I'm generally not opposed to this, but I think the plan should be to eventually remove buildMavenPackage in favor of setup hooks. @NixOS/java: thoughts?

I have discussed the same thing with @wegank today and I agree that setup hooks might be an even better improvement.

So we could first merge that in and setup the switch to setup hooks in a future pr. I am fine with contributing to that too.

What do you think?

@tomodachi94
Copy link
Member

What do you think?

I think that would be ideal in this situation. I'll take a look at this in a moment (if I can wrap my head around how overrides work behind the scenes 😉).

@ofborg ofborg bot added 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 and removed 2.status: merge conflict This PR has merge conflicts with the target branch 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 Nov 24, 2024
@tricktron
Copy link
Member Author

@fricklerhandwerk Could you unblock merging this and/or update your needed points?

Copy link
Member

@tomodachi94 tomodachi94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thank you 💖 If you're interested in maintaining this package, I encourage you to add yourself to meta.maintainers.

@tomodachi94 tomodachi94 added 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Nov 26, 2024
@wegank wegank removed the 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package label Nov 26, 2024
@github-actions github-actions bot added the 6.topic: java Including JDK, tooling, other languages, other VMs label Nov 27, 2024
@tricktron
Copy link
Member Author

Lgtm, thank you 💖 If you're interested in maintaining this package, I encourage you to add yourself to meta.maintainers.

Sure, I added myself to the maintainer list. I may also be interested to join the Nixos Java team in the future. For now, I'll try to check in from time to time to https://matrix.to/#/#jvm:nixos.org but probably more as a silent reader if that is ok:smiley:.

Copy link
Member

@tomodachi94 tomodachi94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thank you ❤️ If you have something to say, feel free to provide input when there's discussion in the channel.

@tomodachi94 tomodachi94 merged commit d3f007d into NixOS:master Nov 27, 2024
17 of 18 checks passed
@TomaSajt
Copy link
Contributor

Just saw that this happened, so I quickly threw together an alternative: #359573

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: java Including JDK, tooling, other languages, other VMs 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 12.approvals: 2 This PR was reviewed and approved by two reputable people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants