2022-06-02 19:43:34 +00:00
|
|
|
{ lib, stdenv, fetchurl }:
|
|
|
|
{ version
|
|
|
|
, artifactId
|
|
|
|
, groupId
|
|
|
|
, sha512
|
|
|
|
, type ? "jar"
|
|
|
|
, suffix ? ""
|
2023-02-14 18:11:59 +00:00
|
|
|
, sourceProvenance ? (lib.optionals (type == "jar") [ lib.sourceTypes.binaryBytecode ])
|
2022-06-02 19:43:34 +00:00
|
|
|
}:
|
2016-10-30 15:41:20 +00:00
|
|
|
|
|
|
|
let
|
2016-11-16 17:39:59 +00:00
|
|
|
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
|
2022-03-01 10:39:32 +00:00
|
|
|
m2File = "${artifactId}-${version}${suffix}.${type}";
|
2019-08-13 21:52:01 +00:00
|
|
|
src = fetchurl {
|
2016-10-30 15:41:20 +00:00
|
|
|
inherit sha512;
|
|
|
|
url = "mirror://maven/${m2Path}/${m2File}";
|
|
|
|
};
|
2019-08-13 21:52:01 +00:00
|
|
|
in stdenv.mkDerivation {
|
2022-03-01 10:39:32 +00:00
|
|
|
inherit version m2Path m2File src;
|
|
|
|
pname = artifactId;
|
2016-10-30 15:41:20 +00:00
|
|
|
|
2021-08-15 11:12:44 +00:00
|
|
|
dontUnpack = true;
|
|
|
|
|
2016-10-30 15:41:20 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/m2/$m2Path
|
|
|
|
cp $src $out/m2/$m2Path/$m2File
|
|
|
|
'';
|
2022-06-02 19:43:34 +00:00
|
|
|
|
|
|
|
meta.sourceProvenance = sourceProvenance;
|
2016-10-30 15:41:20 +00:00
|
|
|
}
|