2022-06-16 17:23:12 +00:00
|
|
|
{ lib, stdenv, fetchurl }:
|
|
|
|
{ version
|
|
|
|
, artifactId
|
|
|
|
, groupId
|
|
|
|
, sha512
|
|
|
|
, type ? "jar"
|
|
|
|
, suffix ? ""
|
|
|
|
, sourceProvenance ? (if type == "jar" then [ lib.sourceTypes.binaryBytecode ] else [])
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
|
2022-03-10 19:12:11 +00:00
|
|
|
m2File = "${artifactId}-${version}${suffix}.${type}";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
|
|
|
inherit sha512;
|
|
|
|
url = "mirror://maven/${m2Path}/${m2File}";
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
2022-03-10 19:12:11 +00:00
|
|
|
inherit version m2Path m2File src;
|
|
|
|
pname = artifactId;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
dontUnpack = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/m2/$m2Path
|
|
|
|
cp $src $out/m2/$m2Path/$m2File
|
|
|
|
'';
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
meta.sourceProvenance = sourceProvenance;
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|