[Nix-dev] nix, Maven and JAR-files

Ragnar Dahlén r.dahlen at gmail.com
Fri Jan 30 18:17:57 CET 2015


Hi,

I've recently started using NixOS and friends and have been really
impressed. I've never had this much confidence in my operating system and
the installed software, and packaging new software has never been this
smooth. The community has also been really helpful. Thank you!

One of my development targets at work is Clojure on the JVM and I'm
contemplating ways of leveraging nix in this world. I have a vague idea of
something I'd like to try, and would appreciate any
feedback/suggestions/references to prior work, including "this is an awful
idea don't do it".

In short, I'd like to use nix to express dependencies on Maven packaged
JARs, and make them available to my package at build or runtime.

For those of you unfamiliar with the Java world, a JAR is typically a Java
Library, and Maven is many things, but what it provides that I'd like to
leverage is:
- a way of naming and versioning JAR files
- dependency resolution for JAR files
- repositories hosting JAR files

Rough outline of how I see this working:

- Provide the ability to express Maven dependencies in a derivation. Not
exactly sure how this would work or look but end result could perhaps be a
set like:
    [{ groupId = "org.clojure"; artifactId = "clojure"; version =
"1.7.0-alpha" } ...];

- Add some functionality for downloading JARs from maven, including
transitive dependencies, and putting those JARs in nix store (the maven
executable sort of knows how to do this). Maven provides sha1 checksums,
maybe leverage those for verification?

- Provide a way to to, given list of dependencies expressed as above, get
the corresponding list of paths to all transitive dependencies in nix
store. This can be used for example in `buildInputs` in order to construct
a full classpath (':' separated list of JAR files) needed by the java
runtime or compiler.

If I had that, I think I could do some more interesting stuff.

As I said, any and all feedback appreciated. Happy to chat about this
off-list on #irc (I'm ragge) if you prefer.

Best regards,
Ragnar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150130/9f362329/attachment.html 


More information about the nix-dev mailing list