summary refs log tree commit diff
path: root/pkgs/development/java-modules/m2install.nix
blob: f223e205220d794a30409f16eeb773510cbb16b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ stdenv, fetchurl }:
{ version, artifactId, groupId, sha512, type ? "jar", suffix ? "" }:

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
  '';
}