nixpkgs/pkgs/development/java-modules/m2install.nix

22 lines
543 B
Nix
Raw Normal View History

2016-10-30 18:41:20 +03:00
{ stdenv, fetchurl }:
2016-11-16 20:39:59 +03:00
{ version, artifactId, groupId, sha512, type ? "jar", suffix ? "" }:
2016-10-30 18:41:20 +03:00
let
2016-11-16 20:39:59 +03:00
name = "${artifactId}-${version}";
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
2016-10-31 20:25:27 +03:00
m2File = "${name}${suffix}.${type}";
2016-10-30 18:41:20 +03:00
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";
}