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 16:41:20 +01:00
let
2016-11-16 18:39:59 +01:00
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
2022-03-01 11:39:32 +01:00
m2File = "${artifactId}-${version}${suffix}.${type}";
2019-08-13 23:52:01 +02:00
src = fetchurl {
2016-10-30 16:41:20 +01:00
inherit sha512;
url = "mirror://maven/${m2Path}/${m2File}";
};
2019-08-13 23:52:01 +02:00
in stdenv.mkDerivation {
2022-03-01 11:39:32 +01:00
inherit version m2Path m2File src;
pname = artifactId;
2016-10-30 16:41:20 +01:00
2021-08-15 13:12:44 +02:00
dontUnpack = true;
2016-10-30 16:41:20 +01:00
installPhase = ''
mkdir -p $out/m2/$m2Path
cp $src $out/m2/$m2Path/$m2File
'';
meta.sourceProvenance = sourceProvenance;
2016-10-30 16:41:20 +01:00
}