git.delta.rocks / jrsonnet / refs/commits / 7da68eaa8a4d

difftreelog

source

nix/sjsonnet.nix2.6 KiBsourcehistory
1# This derivation uses released sjsonnet binary, which most users will use2# However, recommended way of using sjsonnet - is using a client-server model,3# for which there is no released binaries: https://github.com/databricks/sjsonnet/issues/514# TODO: Somehow build client-server version of sjsonnet, and use it in benchmarks5{6  stdenv,7  lib,8  fetchurl,9  jdk25_headless,10  makeWrapper,11  autoPatchelfHook,12  zlib,13  openssl,14  java ? jdk25_headless,15}:16let17  version = "0.6.2";18  baseUrl = "https://github.com/databricks/sjsonnet/releases/download/${version}";1920  nativePlatform = {21    x86_64-linux = "linux-x86_64";22    aarch64-linux = "linux-arm64";23    aarch64-darwin = "darwin-arm64";24    # Nobody cares about darwin on intel25  }.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");2627  nativeSrc = fetchurl {28    url = "${baseUrl}/sjsonnet-${version}-${nativePlatform}";29    hash = {30      x86_64-linux = "sha256-r79Q6SovcPIomDDUYTGIP35/y5t9Xo5Z3ohP7pxsF8I=";31      aarch64-linux = "sha256-LxWR94u1Oncau57Kmtzj2UFEofWGT4+laDTbRDkwv08=";32      aarch64-darwin = "sha256-gNZ6XekMm+ebeD7UFeRfoapXw/90gHk8MoeGD86dzKk=";33    }.${stdenv.hostPlatform.system};34  };3536  graalvmSrc = fetchurl {37    url = "${baseUrl}/sjsonnet-graalvm-${version}-${nativePlatform}";38    hash = {39      x86_64-linux = "sha256-XNJCnQlwVFySrUevn1nLN/DY8UBGgvCFAitkedLB+yM=";40      aarch64-linux = "sha256-J+C3pmiBEmo8M00IDHp9jznonibXmHVRlhsvQ4apVWw=";41      aarch64-darwin = "sha256-TXNL52sS4NE3GjbOFtgf6aCP268qGKMFaoTwAfJfgGc=";42    }.${stdenv.hostPlatform.system};43  };44in45stdenv.mkDerivation {46  pname = "sjsonnet";47  inherit version;4849  src = fetchurl {50    url = "${baseUrl}/sjsonnet-${version}.jar";51    hash = "sha256-jvkrxY48d/UdMGRoB9SxCJU2JJirfhZNyNMSkMrrQ7w=";52  };5354  unpackPhase = "true";55  nativeBuildInputs = [ makeWrapper ]56    ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];57  buildInputs = [ java ]58    ++ lib.optionals stdenv.hostPlatform.isLinux [ zlib openssl stdenv.cc.cc.lib ];5960  installPhase = ''61    mkdir -p $out/bin $out/lib62    cp $src $out/lib/sjsonnet.jar63    makeWrapper ${java}/bin/java $out/bin/sjsonnet --add-flags "-Xss100m -XX:+UseStringDeduplication -jar $out/lib/sjsonnet.jar"6465    cp ${nativeSrc} $out/bin/sjsonnet-native66    chmod +x $out/bin/sjsonnet-native67    wrapProgram $out/bin/sjsonnet-native --add-flags "--max-stack 200000"6869    cp ${graalvmSrc} $out/bin/sjsonnet-graalvm70    chmod +x $out/bin/sjsonnet-graalvm71    wrapProgram $out/bin/sjsonnet-graalvm --add-flags "--max-stack 200000"72  '';73  separateDebugInfo = false;74}