nixpkgs-suyu/pkgs/development/tools/clj-kondo/default.nix
Griffin Smith 3341f6c1fc babashka,clj-kondo: Depend on graalvm-ce
Now that we have community builds of graalvm landed in #99631, both
clj-kondo and babashka can depend on those versions of graalvm rather
than the one that requires building from source - this can be built in
hydra, and generally is much easier to build and test.
2020-11-04 09:09:54 -08:00

51 lines
1.4 KiB
Nix

{ stdenv, lib, graalvm8-ce, fetchurl }:
stdenv.mkDerivation rec {
pname = "clj-kondo";
version = "2020.04.05";
reflectionJson = fetchurl {
name = "reflection.json";
url = "https://raw.githubusercontent.com/borkdude/${pname}/v${version}/reflection.json";
sha256 = "1m6kja38p6aypawbynkyq8bdh8wpdjmyqrhslinqid9r8cl25rcq";
};
src = fetchurl {
url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
sha256 = "0k9samcqkpkdgzbzr2bpixf75987lsabh97101v1fg12qvjhf187";
};
dontUnpack = true;
buildInputs = [ graalvm8-ce ];
buildPhase = ''
native-image \
-jar ${src} \
-H:Name=clj-kondo \
-H:+ReportExceptionStackTraces \
-J-Dclojure.spec.skip-macros=true \
-J-Dclojure.compiler.direct-linking=true \
"-H:IncludeResources=clj_kondo/impl/cache/built_in/.*" \
-H:ReflectionConfigurationFiles=${reflectionJson} \
--initialize-at-build-time \
-H:Log=registerResource: \
--verbose \
--no-fallback \
--no-server \
"-J-Xmx3g"
'';
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/borkdude/clj-kondo";
license = licenses.epl10;
platforms = graalvm8-ce.meta.platforms;
maintainers = with maintainers; [ jlesquembre bandresen ];
};
}