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

gradle: add module #4667

Merged
merged 1 commit into from
Dec 20, 2023
Merged

Conversation

britter
Copy link
Contributor

@britter britter commented Nov 15, 2023

Description

Introduces a new program called gradle for managing files stored in the
home directory by the Gradle Build Tool. Gradle
uses the $HOME/.gradle folder for all it's configuration.

Features of the new program module are:

  • Automatically setting programs.java.enable = true to make a Java
    installation available for running Gradle.
  • Specifying an alternate Gradle home directory
  • Setting of abitrary values for gradle.properties stored inside the
    Gradle home directory.
  • Defining init scripts either by pointing to a directory that will be
    linked to init.d inside the Gradle home directory or by specifying
    a list of init script definitions.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

Copy link
Contributor Author

@britter britter left a comment

Choose a reason for hiding this comment

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

This is my first contribution to the nix eco system. I'm still learning nix. Hope this makes sense!

modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
tests/modules/programs/gradle/gradle.nix Outdated Show resolved Hide resolved
@liff
Copy link
Contributor

liff commented Nov 26, 2023

Would it be possible to add another setting for customizing the dot directory? The environment variable GRADLE_USER_HOME can be used to change ~/.gradle to something else. Something like programs.gradle.home perhaps, that sets home.sessionVariables.GRADLE_USER_HOME accordingly?

modules/programs/gradle.nix Outdated Show resolved Hide resolved
@britter
Copy link
Contributor Author

britter commented Nov 28, 2023

@liff I'll have a look into both your suggestions. Thank you for the feedback!

@britter britter changed the title Add a module for Gradle gradle: Introduce module Dec 1, 2023
@britter britter marked this pull request as draft December 1, 2023 12:37
@britter britter changed the title gradle: Introduce module gradle: add module Dec 1, 2023
Copy link
Contributor Author

@britter britter left a comment

Choose a reason for hiding this comment

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

@liff This is still WIP but I addressed your comments. PTAL.

I'm still not happy with the way init scripts are handled. I think it would be better if the user could either define them inline or reference a file that is copied to the store. But I don't know how to define the type for the option. Can you give me some pointers?

modules/programs/gradle.nix Outdated Show resolved Hide resolved
Copy link
Contributor

@liff liff left a comment

Choose a reason for hiding this comment

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

The value of programs.gradle.home should be used for the location of the generated files.

modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
@britter britter marked this pull request as ready for review December 7, 2023 19:06
@britter
Copy link
Contributor Author

britter commented Dec 7, 2023

@liff this is now ready for the final review / merge. Thank you for your support. I learned a lot along the way. ❤️

modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
@britter
Copy link
Contributor Author

britter commented Dec 8, 2023

@liff anything missing in order to get this merged?

@liff
Copy link
Contributor

liff commented Dec 8, 2023

Looks good to me, but I lack the power to merge 😔

@britter
Copy link
Contributor Author

britter commented Dec 12, 2023

@liff do you know by any chance who to ping to get this merged?

@liff
Copy link
Contributor

liff commented Dec 12, 2023

I guess it would be @rycee by default? Or you could ask on the IRC channel.

It occurred to me that since this is a new module, perhaps it’s worthy of a news entry. New modules usually seem to get one.

modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
modules/programs/gradle.nix Outdated Show resolved Hide resolved
@rycee
Copy link
Member

rycee commented Dec 13, 2023

Thanks for the contribution! I've added a bunch of mostly stylistic comments. The most important is to reduce the test closure to avoid GBs of downloads whenever the tests run 🙂

modules/programs/gradle.nix Outdated Show resolved Hide resolved
@britter britter force-pushed the britter/gradle-module branch 2 times, most recently from 5264c9f to 4131651 Compare December 15, 2023 12:40
@britter
Copy link
Contributor Author

britter commented Dec 15, 2023

@rycee I think I addressed all your comments. Previously the code aggregated all init scripts in a store directory using symlinkJoin. I was unable to get that working with the new structure of the initScript submodule where the source is set from the text. So the current version links individual files from the store inside .gradle/init.d. Unfortunately I didn't find a more elegant solution than home.file = mkMerge ... which feels more complex than it should.

I also added a news entry.

Introduces a new program called gradle for managing files stored in
the home directory by the [Gradle Build Tool](https://gradle.org).
Gradle uses the $HOME/.gradle folder for all it's configuration.

Features of the new program module are:

- Automatically setting programs.java.enable = true to make a Java
  installation available for running Gradle.
- Specifying an alternate Gradle home directory
- Setting of abitrary values for gradle.properties stored inside the
  Gradle home directory.
- Defining init scripts that will be linked into the init.d inside
  the Gradle home directory.

Co-authored-by: Olli Helenius <[email protected]>
Co-authored-by: Robert Helgesson <[email protected]>
@rycee rycee merged commit 433120e into nix-community:master Dec 20, 2023
1 of 3 checks passed
@rycee
Copy link
Member

rycee commented Dec 20, 2023

Thanks! Merged to master now 🙂

britter added a commit to britter/nix-configuration that referenced this pull request Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants