nixpkgs/pkgs/development/tools/zprint/default.nix
Thiago Kenji Okada e4a1d32922 zprint: reduce closure size
Before:

```
nix path-info -S ./result -h
/nix/store/06i7frz4c4plpcmws5l57rqfd0nm20lm-zprint-1.1.2	  1.9G
```

After:

```
$ nix path-info -S ./result -h
/nix/store/irhavk9z81cgz3jwqxm7v7svmxdpqp9k-zprint-1.1.2	 93.4M
```
2021-10-02 11:47:59 -03:00

52 lines
1.5 KiB
Nix

{ stdenv, lib, fetchurl, graalvm11-ce, glibcLocales }:
stdenv.mkDerivation rec {
pname = "zprint";
version = "1.1.2";
src = fetchurl {
url =
"https://github.com/kkinnear/${pname}/releases/download/${version}/${pname}-filter-${version}";
sha256 = "1wh8jyj7alfa6h0cycfwffki83wqb5d5x0p7kvgdkhl7jx7isrwj";
};
dontUnpack = true;
LC_ALL = "en_US.UTF-8";
nativeBuildInputs = [ graalvm11-ce glibcLocales ];
buildPhase = ''
native-image \
--no-server \
-J-Xmx7G \
-J-Xms4G \
-jar ${src} \
-H:Name=${pname} \
-H:EnableURLProtocols=https,http \
-H:+ReportExceptionStackTraces \
-H:CLibraryPath=${graalvm11-ce.lib}/lib \
${lib.optionalString stdenv.isDarwin ''-H:-CheckToolchain''} \
--report-unsupported-elements-at-runtime \
--initialize-at-build-time \
--no-fallback
'';
installPhase = ''
mkdir -p $out/bin
install ${pname} $out/bin
'';
meta = with lib; {
description = "Clojure/EDN source code formatter and pretty printer";
longDescription = ''
Library and command line tool providing a variety of pretty printing capabilities
for both Clojure code and Clojure/EDN structures. It can meet almost anyone's needs.
As such, it supports a number of major source code formatting approaches
'';
homepage = "https://github.com/kkinnear/zprint";
license = licenses.mit;
platforms = graalvm11-ce.meta.platforms;
maintainers = with maintainers; [ stelcodes ];
};
}