buildMaven: Handle authenticated repos

This commit is contained in:
Shea Levy 2015-07-08 06:24:55 -04:00
parent e987d1c1e3
commit a5a8bad0e6

View file

@ -1,4 +1,4 @@
{ stdenv, maven, runCommand, writeText, fetchurl, lib }:
{ stdenv, maven, runCommand, writeText, fetchurl, lib, requireFile }:
/* Takes an info file generated by mvn2nix
* (https://github.com/NixOS/mvn2nix-maven-plugin) and builds the maven
* project with it.
@ -15,9 +15,11 @@ infoFile: let
script = writeText "build-maven-repository.sh" ''
${lib.concatStrings (map (dep: let
inherit (dep) url sha1 groupId artifactId version;
inherit (dep) url sha1 groupId artifactId version authenticated;
fetch = fetchurl { inherit url sha1; };
fetch = (if authenticated then requireFile else fetchurl) {
inherit url sha1;
};
in ''
dir=$out/$(echo ${groupId} | sed 's|\.|/|g')/${artifactId}/${version}
mkdir -p $dir