3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/interpreters/clojure/babashka.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
2.6 KiB
Nix
Raw Normal View History

2021-11-23 14:58:32 +00:00
{ lib, buildGraalvmNativeImage, fetchurl, writeScript }:
2020-04-04 22:20:32 +01:00
2021-11-23 14:58:32 +00:00
buildGraalvmNativeImage rec {
2020-04-04 22:20:32 +01:00
pname = "babashka";
2022-12-09 08:43:23 +00:00
version = "1.0.168";
2020-04-04 22:20:32 +01:00
src = fetchurl {
2021-04-22 15:14:20 +01:00
url = "https://github.com/babashka/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
2022-12-09 08:43:23 +00:00
sha256 = "sha256-K56SEfSq0mjltUwR2VZxGiGn9nnEdDBoZrkaBOIIl7k=";
2020-04-04 22:20:32 +01:00
};
2021-11-23 14:58:32 +00:00
executable = "bb";
2020-04-04 22:20:32 +01:00
2021-11-23 14:58:32 +00:00
extraNativeImageBuildArgs = [
"-H:+ReportExceptionStackTraces"
"--no-fallback"
"--native-image-info"
];
installCheckPhase = ''
$out/bin/bb --version | grep '${version}'
$out/bin/bb '(+ 1 2)' | grep '3'
$out/bin/bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]' | grep '[1 2]'
2020-04-04 22:20:32 +01:00
'';
2021-10-19 22:30:11 +01:00
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; {
2020-04-04 22:20:32 +01:00
description = "A Clojure babushka for the grey areas of Bash";
longDescription = ''
2020-05-20 22:30:06 +01:00
The main idea behind babashka is to leverage Clojure in places where you
2020-04-04 22:20:32 +01:00
would be using bash otherwise.
As one user described it:
2020-05-20 22:30:06 +01:00
Im quite at home in Bash most of the time, but theres a substantial
grey area of things that are too complicated to be simple in bash, but
too simple to be worth writing a clj/s script for. Babashka really
2020-04-04 22:20:32 +01:00
seems to hit the sweet spot for those cases.
Goals:
- Low latency Clojure scripting alternative to JVM Clojure.
- Easy installation: grab the self-contained binary and run. No JVM needed.
- Familiarity and portability:
- Scripts should be compatible with JVM Clojure as much as possible
2020-05-20 22:30:06 +01:00
- Scripts should be platform-independent as much as possible. Babashka
2020-04-04 22:20:32 +01:00
offers support for linux, macOS and Windows.
- Allow interop with commonly used classes like java.io.File and System
- Multi-threading support (pmap, future, core.async)
- Batteries included (tools.cli, cheshire, ...)
- Library support via popular tools like the clojure CLI
'';
2021-05-30 03:26:37 +01:00
homepage = "https://github.com/babashka/babashka";
2021-09-01 21:19:45 +01:00
changelog = "https://github.com/babashka/babashka/blob/v${version}/CHANGELOG.md";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
2020-04-04 22:20:32 +01:00
license = licenses.epl10;
2021-05-30 03:26:37 +01:00
maintainers = with maintainers; [
bandresen
bhougland
DerGuteMoritz
jlesquembre
thiagokokada
];
2020-04-04 22:20:32 +01:00
};
}