2022-06-02 20:43:34 +01:00
|
|
|
{ lib, stdenv, fetchurl }:
|
|
|
|
{ version
|
|
|
|
, artifactId
|
|
|
|
, groupId
|
|
|
|
, sha512
|
|
|
|
, type ? "jar"
|
|
|
|
, suffix ? ""
|
|
|
|
, sourceProvenance ? (if type == "jar" then [ lib.sourceTypes.binaryBytecode ] else [])
|
|
|
|
}:
|
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 22:52:01 +01:00
|
|
|
src = fetchurl {
|
2016-10-30 15:41:20 +00:00
|
|
|
inherit sha512;
|
|
|
|
url = "mirror://maven/${m2Path}/${m2File}";
|
|
|
|
};
|
2019-08-13 22:52:01 +01: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 12:12:44 +01: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 20:43:34 +01:00
|
|
|
|
|
|
|
meta.sourceProvenance = sourceProvenance;
|
2016-10-30 15:41:20 +00:00
|
|
|
}
|