summary refs log tree commit diff
path: root/pkgs/development/java-modules/m2install.nix
blob: 56ae8132c61cf2eb7e77d763ad6602b174a73044 (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, baseName, package, sha512, type ? "jar" }:

let
  name = "${baseName}-${version}";
  m2Path = "${package}/${baseName}/${version}";
  m2File = "${name}.${type}";
  src = fetchurl rec {
      inherit sha512;
      url = "mirror://maven/${m2Path}/${m2File}";
  };
in stdenv.mkDerivation rec {
  inherit name m2Path m2File src;

  installPhase = ''
    mkdir -p $out/m2/$m2Path
    cp $src $out/m2/$m2Path/$m2File
  '';

  phases = "installPhase";
}