clojure: add passthru.updateScript

conduit-nginx
Thiago Kenji Okada 2021-10-19 20:16:00 -03:00
parent 5b3ac7b07e
commit f661c6b18b
1 changed files with 19 additions and 2 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, installShellFiles, jdk, rlwrap, makeWrapper }:
{ lib, stdenv, fetchurl, installShellFiles, jdk, rlwrap, makeWrapper, writeScript }:
stdenv.mkDerivation rec {
pname = "clojure";
@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
# https://clojure.org/releases/tools
url = "https://download.clojure.org/install/clojure-tools-${version}.tar.gz";
sha256 = "1xhfp186mk9h3jdl9bpkigqrrrgdhgij7ba65j6783nh11llpa3x";
sha256 = "fahLaQjQDnSMLEatI+OD7eWc8YvzrkSbHDDNalC4DvY=";
};
nativeBuildInputs = [
@ -48,12 +48,29 @@ stdenv.mkDerivation rec {
'';
doInstallCheck = true;
installCheckPhase = ''
CLJ_CONFIG=$TMPDIR CLJ_CACHE=$TMPDIR/.clj_cache $out/bin/clojure \
-Spath \
-Sverbose \
-Scp $out/libexec/clojure-tools-${version}.jar
'';
passthru.updateScript = writeScript "update-clojure" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts jq
set -euo pipefail
# `jq -r '.[0].name'` results in `v0.0`
readonly latest_version="$(curl \
''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
-s "https://api.github.com/repos/clojure/brew-install/tags" \
| jq -r '.[1].name')"
update-source-version clojure "$latest_version"
'';
meta = with lib; {
description = "A Lisp dialect for the JVM";
homepage = "https://clojure.org/";