[Nix-dev] How to implement fetchMaven as pure function ?

Volth volth at volth.com
Tue May 9 13:41:03 CEST 2017


There are already two versions in nixpkgs ("fetchMaven" and
"fetchMavenArtifact") which are just wrappers for "fetchurl".


Basicaly "fetchMaven" is merely a function giving argument
"org.scala-lang:scala-compiler:2.11.11" produces a derivation by
downloading two files

  https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.11/scala-compiler-2.11.11.pom
  https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.11/scala-compiler-2.11.11.jar

into $out/share/java/.


Besides the obvious hacky ways, how would it be possible to implement
"fetchMaven" in a way that the output path in nixstore depend only on
the argument ?

Only on the string "org.scala-lang:scala-compiler:2.11.11" and not on
curl version or buildScript's evolution (e.g. it could download PGP
signature and validate it)

Then the jar files would be easily discoverable by the external tools
doing the same calculation.


More information about the nix-dev mailing list