depot/third_party/nixpkgs/pkgs/development/java-modules/m2install.nix
Default email 3a4df29a92 Project import generated by Copybara.
GitOrigin-RevId: 3d7435c638baffaa826b85459df0fff47f12317d
2022-06-16 19:23:12 +02:00

30 lines
677 B
Nix

{ lib, stdenv, fetchurl }:
{ version
, artifactId
, groupId
, sha512
, type ? "jar"
, suffix ? ""
, sourceProvenance ? (if type == "jar" then [ lib.sourceTypes.binaryBytecode ] else [])
}:
let
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
m2File = "${artifactId}-${version}${suffix}.${type}";
src = fetchurl {
inherit sha512;
url = "mirror://maven/${m2Path}/${m2File}";
};
in stdenv.mkDerivation {
inherit version m2Path m2File src;
pname = artifactId;
dontUnpack = true;
installPhase = ''
mkdir -p $out/m2/$m2Path
cp $src $out/m2/$m2Path/$m2File
'';
meta.sourceProvenance = sourceProvenance;
}