nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchurl }:
2{ version, artifactId, groupId, sha512, type ? "jar", suffix ? "" }:
3
4let
5 m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
6 m2File = "${artifactId}-${version}${suffix}.${type}";
7 src = fetchurl {
8 inherit sha512;
9 url = "mirror://maven/${m2Path}/${m2File}";
10 };
11in stdenv.mkDerivation {
12 inherit version m2Path m2File src;
13 pname = artifactId;
14
15 dontUnpack = true;
16
17 installPhase = ''
18 mkdir -p $out/m2/$m2Path
19 cp $src $out/m2/$m2Path/$m2File
20 '';
21}