Build support

This commit is contained in:
Tim Steinbach 2016-10-30 11:41:20 -04:00
parent 870fc84412
commit d849c0e2e1
No known key found for this signature in database
GPG Key ID: 83FF2ACAEB6C2D24
4 changed files with 56 additions and 0 deletions

View File

@ -396,4 +396,9 @@ rec {
https://archive.mozilla.org/pub/
];
# Maven Central
maven = [
http://repo1.maven.org/maven2
http://central.maven.org/maven2
];
}

View File

@ -0,0 +1,26 @@
{ stdenv, maven, lib }:
{ mavenDeps, src, name, meta, m2Path, ... }:
with builtins;
with lib;
stdenv.mkDerivation rec {
inherit mavenDeps src name meta m2Path;
flatDeps = flatten mavenDeps;
propagatedBuildInput = [ maven ] ++ flatDeps;
find = ''find ${foldl' (x: y: x + " " + y) "" (map (x: x + "/m2/") flatDeps)} -type d -printf '%P\n' | xargs -I {} mkdir -p $out/m2/{}'';
copy = ''cp -rs ${foldl' (x: y: x + " " + y) "" (map (x: x + "/m2/*") flatDeps)} $out/m2'';
buildPhase = ''
mkdir -p $out/m2/${m2Path}
${optionalString (length flatDeps > 0) find}
${optionalString (length flatDeps > 0) copy}
echo "<settings><mirrors>\
<mirror><id>tmpm2</id><url>file://$out/m2</url><mirrorOf>*</mirrorOf></mirror></mirrors>\
<localRepository>$out/m2</localRepository></settings>" >> $out/m2/settings.xml
${maven}/bin/mvn clean install -Dmaven.test.skip=true -gs $out/m2/settings.xml
'';
}

View File

@ -0,0 +1,21 @@
{ stdenv, fetchurl }:
{ version, baseName, package, sha512, type ? "jar" }:
let
name = "${baseName}-${version}";
m2Path = "${package}/${baseName}/${version}";
m2File = "${name}.${type}";
src = fetchurl rec {
inherit sha512;
url = "mirror://maven/${m2Path}/${m2File}";
};
in stdenv.mkDerivation rec {
inherit name m2Path m2File src;
installPhase = ''
mkdir -p $out/m2/$m2Path
cp $src $out/m2/$m2Path/$m2File
'';
phases = "installPhase";
}

View File

@ -9761,6 +9761,10 @@ in
leaps = callPackage ../development/tools/leaps { };
### DEVELOPMENT / JAVA MODULES
javaPackages = recurseIntoAttrs (callPackage ./java-packages.nix { });
### DEVELOPMENT / LISP MODULES
asdf = callPackage ../development/lisp-modules/asdf {