[Nix-dev] Nix for Java Development?

Marc Weber marco-oweber at gmx.de
Mon May 5 14:32:45 CEST 2014


Hi Charles O'Farrell,

you're totally right. There are two worlds:

One being perfect (theory)
and the real world (trying to get things done)

Which view to use when solving problems? Do they differ ?

This wiki page lists impurities Nix is fine with:
https://nixos.org/wiki/Nix_impurities

One of the big impurities which got introduced was parallel building, eg
using make -jN -lN.
And yes, for some projects this fails. But I still consider it to be a
feature worth having.

Now for Java you suggest Nix to ignore the java version.
+ less recompliations
- but if the recompilation or compiler compatibility fails (eg due to a
  bug) - you're in trouble, you cannot just redistribute.

The main advantage of Nix we love is: If it runs it should run always
and the property "its running should be reproducable".

There are always ways to force rebuilding by introducing manual env vars
you can "bump" to cause rebuilds.

About having different java versions this comes closest:
pkgs/build-support/replace-dependency.nix
(didn't test it)

Now you say that you may have 100 dependencies - and rebuilding
everything will take time. Sure. It will. Even more in the Scala case.

How can Nix help you doing it?
  - distributed building
  - building on multiple cores on the same machine

If this is not fast enough you either have to patch Nix, or choose a
different tool. If a single file changes a full rebuild will take place.

I recall that someone (Eelco?) had in mind turning make rules into nix
derivations, thus rebuild every single .c file on its own.
I'm unaware whether this ever got implemented. cmake today has many
backends for instance.

Most Java packages are binary packages in nixpkgs.

Marc Weber


More information about the nix-dev mailing list