nixpkgs/pkgs/development/tools/clj-kondo/default.nix

53 lines
1.5 KiB
Nix
Raw Normal View History

2020-11-07 18:52:45 +00:00
{ stdenv, lib, graalvm11-ce, fetchurl }:
2019-08-08 19:38:04 +00:00
stdenv.mkDerivation rec {
2019-08-08 19:38:04 +00:00
pname = "clj-kondo";
2021-02-13 16:01:00 +00:00
version = "2021.02.13";
2019-08-08 19:38:04 +00:00
reflectionJson = fetchurl {
name = "reflection.json";
url = "https://raw.githubusercontent.com/borkdude/${pname}/v${version}/reflection.json";
sha256 = "ea5c18586fd8803b138a4dd197a0019d5e5a2c76ebe4925b9b54a10125a68c57";
2019-08-08 19:38:04 +00:00
};
src = fetchurl {
url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
2021-02-13 16:01:00 +00:00
sha256 = "sha256-Rq7W5sP9nRB0TGRUSQIyC3U568uExmcM/gd+1HjAqac=";
2019-08-08 19:38:04 +00:00
};
dontUnpack = true;
2020-11-07 18:52:45 +00:00
buildInputs = [ graalvm11-ce ];
2019-08-08 19:38:04 +00:00
buildPhase = ''
native-image \
-jar ${src} \
-H:Name=clj-kondo \
${lib.optionalString stdenv.isDarwin ''-H:-CheckToolchain''} \
2019-08-08 19:38:04 +00:00
-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";
2019-08-08 19:38:04 +00:00
license = licenses.epl10;
2020-11-07 18:52:45 +00:00
platforms = graalvm11-ce.meta.platforms;
maintainers = with maintainers; [ jlesquembre bandresen ];
2019-08-08 19:38:04 +00:00
};
}