| 6 May 2026 |
msgilligan | The other bootstrappability thing I need to learn how to do (with Nix) is pull in Java libraries built from source into the dependency chain. secp256k1-jdk has only 3 build-time/run-time dependencies: JSpecify and either Bouncy Castle or libsecp256k1 (C library) depending upon which run-time implementation you choose. (lib) secp256k1 is already in Nix and built from source. JSpecify is there, but with binary provenance. Bouncy Castle is not in Nixpkgs at all. So it seems doable. It's not on the top of my list, but maybe it will happen by the end of the year or early next year. | 06:28:03 |
msgilligan | Has anyone built or seen a Nixpkgs Java package that pulls one/some/all JAR dependencies from Nixpkgs rather than Maven Central? | 06:29:55 |
msgilligan | (And both JSpecify and Bouncy Castle use Gradle for their builds so there would still be some binary turtles in there.) | 06:38:22 |
Benedikt Ritter (britter) | if the ability to bootstrap is a big concern to you then maven if probably an easier toolchain than Gradle. Although it's still not trivial. | 06:53:35 |
Benedikt Ritter (britter) | Regarding building Java from source: There are two things I've been thinking of. 1) a buildJava hook that can build a java application from source without going through another build tool. That would be great by itself to write small utilities in Java. 2) Far more complicated: providing a way to inject jars build by Nix into the dependency FODs of Maven or Gradle. I don't think either supports this. But it's probably what you need. | 06:55:24 |
Benedikt Ritter (britter) | Based on that we could have a java packages set like we have for python where you can essentially build the whole (java) dependency chain from source. | 06:56:09 |
Benedikt Ritter (britter) | Nice weekend project, I'd say. | 06:56:21 |
msgilligan | It looks like there is a mechanism to do something close to this with Ant: https://nixos.org/manual/nixpkgs/stable/#sec-language-java | 07:09:39 |
msgilligan | I assume you are being sarcastic, but I don't know. You are an amazing developer. | 07:10:55 |
msgilligan | I think approach 1 would be fun to build and would be a useful tool/hook for others, but for external projects would essentially require maintaining a parallel build. | 07:13:28 |
msgilligan | * I think approach 1 would be fun to build and would be a useful tool/hook for others (for some subset of use-cases), but for external projects it would essentially require maintaining a parallel build. | 07:14:55 |
msgilligan | This blog post also seems relevant: https://fzakaria.com/2025/04/02/nix-that-looks-like-bazel | 07:39:08 |
Benedikt Ritter (britter) | Yes, this would only be for orgs that work in a mono repo where nix is the build tool that drives everything and they just have a few java things.
I think if your going polyglot nix is probably your best bet 🤷♂️ | 08:07:04 |
Benedikt Ritter (britter) | It's nice for you to say this, thank you. Honestly I often feel like I have no idea what I'm doing. I just ask a lot of silly questions to people that know more than I do. | 08:08:07 |
Benedikt Ritter (britter) | Imposter syndrome hits hard, I guess. | 08:08:23 |
msgilligan |
I just ask a lot of silly questions to people that know more than I do.
That's what I'm doing right now.
| 08:09:04 |
Benedikt Ritter (britter) |
Nixpkgs already has this great concept that any JAR placed in share/java gets automatically added to the CLASSPATH during compilation in a mkDerivation.
What??? TIL
| 08:10:53 |
msgilligan | It's late here, so I'm going to call it a night. As far as Nixpkgs go, I need to do some updating to my machine so I can run tests, then I want to try to review some PRs and try to submit a few PRs to update some of the JDKs that need updates (e.g. Zulu) After that I should probably try adding a build-from-source package (using the Bouncy Castle Gradle build.) Baby steps... | 08:11:55 |
Benedikt Ritter (britter) | This was a great read. Thank you for sharing it! | 08:12:41 |
msgilligan |
What??? TIL
I think this is mentioned in the Ant section of the Nixpkgs manual that I linked above.
| 08:12:59 |
msgilligan | Farid lives in the same town as me and I met him at Planet Nix last year. He's awesome and has some awesome blogs and posts. | 08:13:41 |
msgilligan | Redacted or Malformed Event | 08:15:44 |
Benedikt Ritter (britter) | All these little tricks that you need to know with nixpks... it's crazy.
Like last week I learned about versionCheckHook. So now I need to replace a bunch of passthru.tests.version things 😅 | 08:19:26 |
Benedikt Ritter (britter) | I gave packaging a java app using GraalVM via Nix a spin this week and wrote about what I learned here: https://britter.dev/blog/2026/05/06/jfmt-nixvim/ | 09:23:33 |
msgilligan | * | 13:46:37 |
msgilligan | I opened a Bouncy Castle in Nixpkgs discussion on github:bcgit/bc-java | 15:35:50 |
msgilligan | Personally, I think someone should write a Nix-friendly (and GUIX-friendly) Java build tool that targets simple library builds and focuses on building without any network access. It would be easy to wrap with Nix (or GUIX) but would also work standalone. I imagine it would have an optional fetch-from-Maven component for standalone use. I've also thought it might be cool to do something in Clojure for this purpose, since Clojure is bootstrappable. | 15:41:48 |
Benedikt Ritter (britter) | It would be nice to have something like this, but I wonder how you would convince library projects to migrate to that? E.g. what would they gain by using that build tool compared to now? | 15:44:48 |
msgilligan | Yeah, I wouldn't expect much uptake outside of the Nix and Guix communities. (At least initially.) | 15:45:44 |
msgilligan | Have you seen Bach? It seems to be in the same ballpark. | 15:47:08 |