nixpkgs/pkgs/development/tools/clj-kondo/default.nix
Thiago Kenji Okada bc40a84b55 clj-kondo: refactor and reduce closure size
Use the new `native-image.properties` to simplify build:
https://github.com/clj-kondo/clj-kondo/pull/1373

Also link to `graalvm11-ce.lib` to reduce closure size:

Before:

```
$ nix path-info -S ./result -h
/nix/store/bc46ki5sj5abbdfsighvvvlk03qnzrp5-clj-kondo-2021.09.25	  1.9G
```

After:

```
$ nix path-info -S ./result -h
/nix/store/6mzk1f3j2j7lzzg378jl1g86p4pkz43z-clj-kondo-2021.09.25	 74.1M
```
2021-10-02 11:39:13 -03:00

47 lines
1.3 KiB
Nix

{ stdenv, lib, graalvm11-ce, fetchurl }:
stdenv.mkDerivation rec {
pname = "clj-kondo";
version = "2021.09.25";
src = fetchurl {
url = "https://github.com/clj-kondo/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
sha256 = "sha256-kS6bwsYH/cbjJlIeiDAy6QsAw+D1uHp26d4NBLfStjg=";
};
dontUnpack = true;
buildInputs = [ graalvm11-ce ];
buildPhase = ''
runHook preBuild
# https://github.com/clj-kondo/clj-kondo/blob/v2021.09.25/script/compile#L17-L21
args=("-jar" "$src"
"-H:CLibraryPath=${graalvm11-ce.lib}/lib"
# Required to build babashka on darwin. Do not remove.
"${lib.optionalString stdenv.isDarwin "-H:-CheckToolchain"}"
"-H:+ReportExceptionStackTraces"
"--verbose"
"--no-fallback"
"-J-Xmx3g")
native-image ''${args[@]}
runHook postBuild
'';
installPhase = ''
mkdir -p $out/bin
cp clj-kondo $out/bin/clj-kondo
'';
meta = with lib; {
description = "A linter for Clojure code that sparks joy";
homepage = "https://github.com/clj-kondo/clj-kondo";
license = licenses.epl10;
platforms = graalvm11-ce.meta.platforms;
maintainers = with maintainers; [ jlesquembre bandresen thiagokokada ];
};
}