1{ stdenv, fetchurl }:
2{ version, artifactId, groupId, sha512, type ? "jar", suffix ? "" }:
3
4let
5 name = "${artifactId}-${version}";
6 m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
7 m2File = "${name}${suffix}.${type}";
8 src = fetchurl rec {
9 inherit sha512;
10 url = "mirror://maven/${m2Path}/${m2File}";
11 };
12in stdenv.mkDerivation rec {
13 inherit name m2Path m2File src;
14
15 installPhase = ''
16 mkdir -p $out/m2/$m2Path
17 cp $src $out/m2/$m2Path/$m2File
18 '';
19
20 phases = "installPhase";
21}