Skip to content

This Repository is a playing ground to start putting together something working from Gradle, Java and Nix(OS)

License

Notifications You must be signed in to change notification settings

eeedean/inventory-backend

Repository files navigation

Java + Gradle + Nix = 💀

I'm trying to get my first realistic Java-Gradle-Nix setup flying. This does not work right now unfortunately.

Goal

  • Using Java 21
  • Spring Boot
  • Custom JRE (as small as possible)
  • Testcontainers for integration testing with JUnit
  • Docker image being built

Dev station setup

  • MacBook Pro 16" 2021; M1 Max; 32 GB RAM
  • macOS Sequoia 15.0.1
  • nix-darwin Setup
  • linux-builder enabled:
linux-builder = {
      enable = true;
      ephemeral = true;
      maxJobs = 8;
      config = {
        nix.settings.sandbox = false;
        networking = {
          nameservers = ["8.8.8.8" "1.1.1.1"];
        };
        virtualisation = {
          darwin-builder = {
            diskSize = 40 * 1024;
            memorySize = 8 * 1024;
          };
          cores = 8;
          msize = 128 * 1024;
        };
      };
};

Building

nix build does build the spring boot application.

Current problem(s):

gradle-dot-nix does not yet support multiple valid hashes for dependencies in verification-metadata.xml. This may be a problem, if the repositories in nix and gradle aren't used in the exact same order for any reason, or just cannot be the same.

gradle/verification-metadata.xml

      <artifact name="jackson-modules-java8-2.17.2.pom">
        <sha256 value="fc0839cd9bbac2774ac8cf2aec51f4088a69369575e7a963f972cc07f4fcb8b3" origin="Generated by Gradle">
          <also-trust value="3f39c55109f51a228817b4b185e4351b9ef0501c09fc1e1a3075ae9547cc2d03"/>
        <!--<sha256 value="3f39c55109f51a228817b4b185e4351b9ef0501c09fc1e1a3075ae9547cc2d03" origin="Generated by Gradle">-->
          <!--<also-trust value="fc0839cd9bbac2774ac8cf2aec51f4088a69369575e7a963f972cc07f4fcb8b3"/>-->
        </sha256>
      </artifact>

You can just comment in the lines, i commented out and comment out the other two in order to switch the hashes. When switched, it works, when not switched, it wont work.

About

This Repository is a playing ground to start putting together something working from Gradle, Java and Nix(OS)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published