From 38001b1454d57061bbc910de06992d226f7400e8 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 19 Oct 2021 18:30:11 -0300 Subject: [PATCH] babashka: add passthru.updateScript --- .../interpreters/clojure/babashka.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/clojure/babashka.nix b/pkgs/development/interpreters/clojure/babashka.nix index 7250dbf45bf5..7d7a216b2fb7 100644 --- a/pkgs/development/interpreters/clojure/babashka.nix +++ b/pkgs/development/interpreters/clojure/babashka.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, graalvm11-ce, glibcLocales }: +{ lib, stdenv, fetchurl, graalvm11-ce, glibcLocales, writeScript }: stdenv.mkDerivation rec { pname = "babashka"; @@ -58,6 +58,21 @@ stdenv.mkDerivation rec { $out/bin/bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]' | grep '[1 2]' ''; + passthru.updateScript = writeScript "update-babashka" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl common-updater-scripts jq + + set -euo pipefail + + readonly latest_version="$(curl \ + ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \ + -s "https://api.github.com/repos/babashka/babashka/releases/latest" \ + | jq -r '.tag_name')" + + # v0.6.2 -> 0.6.2 + update-source-version babashka "''${latest_version/v/}" + ''; + meta = with lib; { description = "A Clojure babushka for the grey areas of Bash"; longDescription = ''