|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchurl, |
| 5 | + jre, |
| 6 | + makeWrapper, |
| 7 | + which |
| 8 | +}: |
| 9 | + |
| 10 | +stdenv.mkDerivation (finalAttrs: { |
| 11 | + pname = "mill"; |
| 12 | + version = "1.0.3"; |
| 13 | + |
| 14 | + src = fetchurl { |
| 15 | + url = "https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/${finalAttrs.version}/mill-dist-${finalAttrs.version}.exe"; |
| 16 | + hash = "sha256-T/Wl9A6iBt12so0SO+G8sfkiahyJp0/NqH7Rs1g2FSU="; |
| 17 | + }; |
| 18 | + |
| 19 | + nativeBuildInputs = [ makeWrapper which ]; |
| 20 | + |
| 21 | + dontUnpack = true; |
| 22 | + dontConfigure = true; |
| 23 | + dontBuild = true; |
| 24 | + |
| 25 | + # this is mostly downloading a pre-built artifact |
| 26 | + preferLocal = true; |
| 27 | + |
| 28 | + installPhase = '' |
| 29 | + runHook preInstall |
| 30 | + install -Dm555 "$src" "$out/bin/.mill-wrapped" |
| 31 | + # can't use wrapProgram because it sets --argv0 |
| 32 | + makeWrapper "$out/bin/.mill-wrapped" "$out/bin/mill" \ |
| 33 | + --prefix PATH : "${jre}/bin" \ |
| 34 | + --set JAVA_HOME "${jre}" |
| 35 | + runHook postInstall |
| 36 | + ''; |
| 37 | + |
| 38 | + doInstallCheck = true; |
| 39 | + # The default release is a script which will do an impure download |
| 40 | + # just ensure that the application can run without network |
| 41 | + # installCheckPhase = '' |
| 42 | + # $out/bin/mill --help > /dev/null |
| 43 | + # ''; |
| 44 | + |
| 45 | + meta = with lib; { |
| 46 | + homepage = "https://com-lihaoyi.github.io/mill/"; |
| 47 | + license = licenses.mit; |
| 48 | + description = "Build tool for Scala, Java and more"; |
| 49 | + mainProgram = "mill"; |
| 50 | + longDescription = '' |
| 51 | + Mill is a build tool borrowing ideas from modern tools like Bazel, to let you build |
| 52 | + your projects in a way that's simple, fast, and predictable. Mill has built in |
| 53 | + support for the Scala programming language, and can serve as a replacement for |
| 54 | + SBT, but can also be extended to support any other language or platform via |
| 55 | + modules (written in Java or Scala) or through an external subprocesses. |
| 56 | + ''; |
| 57 | + maintainers = with maintainers; [ |
| 58 | + scalavision |
| 59 | + zenithal |
| 60 | + ]; |
| 61 | + platforms = lib.platforms.all; |
| 62 | + }; |
| 63 | +}) |
0 commit comments