nixpkgs/pkgs/development/java-modules/m2install.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
677 B
Nix
Raw Normal View History

{ 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 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
'';
meta.sourceProvenance = sourceProvenance;
2016-10-30 15:41:20 +00:00
}