···
9
-
buildGraalvmNativeImage rec {
10
-
pname = "babashka-unwrapped";
11
-
version = "1.3.184";
10
+
babashka-unwrapped = buildGraalvmNativeImage rec {
11
+
pname = "babashka-unwrapped";
12
+
version = "1.3.184";
15
+
url = "https://github.com/babashka/babashka/releases/download/v${version}/babashka-${version}-standalone.jar";
16
+
sha256 = "sha256-O3pLELYmuuB+Bf1vHTWQ+u7Ymi3qYiMRpCwvEq+GeBQ=";
19
+
graalvmDrv = graalvmCEPackages.graalvm-ce;
14
-
url = "https://github.com/babashka/babashka/releases/download/v${version}/babashka-${version}-standalone.jar";
15
-
sha256 = "sha256-O3pLELYmuuB+Bf1vHTWQ+u7Ymi3qYiMRpCwvEq+GeBQ=";
18
-
graalvmDrv = graalvmCEPackages.graalvm-ce;
23
+
nativeBuildInputs = [ removeReferencesTo ];
25
+
extraNativeImageBuildArgs = [
26
+
"-H:+ReportExceptionStackTraces"
28
+
"--native-image-info"
22
-
nativeBuildInputs = [ removeReferencesTo ];
32
+
doInstallCheck = true;
24
-
extraNativeImageBuildArgs = [
25
-
"-H:+ReportExceptionStackTraces"
27
-
"--native-image-info"
34
+
installCheckPhase = ''
35
+
$out/bin/bb --version | grep '${version}'
36
+
$out/bin/bb '(+ 1 2)' | grep '3'
37
+
$out/bin/bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]' | grep '[1 2]'
31
-
doInstallCheck = true;
40
+
# As of v1.2.174, this will remove references to ${graalvmDrv}/conf/chronology,
41
+
# not sure the implications of this but this file is not available in
42
+
# graalvm-ce anyway.
44
+
remove-references-to -t ${graalvmDrv} $out/bin/${executable}
33
-
installCheckPhase = ''
34
-
$out/bin/bb --version | grep '${version}'
35
-
$out/bin/bb '(+ 1 2)' | grep '3'
36
-
$out/bin/bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]' | grep '[1 2]'
47
+
passthru.updateScript = writeScript "update-babashka" ''
48
+
#!/usr/bin/env nix-shell
49
+
#!nix-shell -i bash -p curl common-updater-scripts jq libarchive
39
-
# As of v1.2.174, this will remove references to ${graalvmDrv}/conf/chronology,
40
-
# not sure the implications of this but this file is not available in
41
-
# graalvm-ce anyway.
43
-
remove-references-to -t ${graalvmDrv} $out/bin/${executable}
52
+
shopt -s inherit_errexit
46
-
passthru.updateScript = writeScript "update-babashka" ''
47
-
#!/usr/bin/env nix-shell
48
-
#!nix-shell -i bash -p curl common-updater-scripts jq
54
+
latest_version="$(curl \
55
+
''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
56
+
-fsL "https://api.github.com/repos/babashka/babashka/releases/latest" \
57
+
| jq -r '.tag_name')"
59
+
if [ "$(update-source-version babashka-unwrapped "''${latest_version/v/}" --print-changes)" = "[]" ]; then
60
+
# no need to update babashka.clojure-tools when babashka-unwrapped wasn't updated
52
-
readonly latest_version="$(curl \
53
-
''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
54
-
-s "https://api.github.com/repos/babashka/babashka/releases/latest" \
55
-
| jq -r '.tag_name')"
64
+
clojure_tools_version=$(curl \
66
+
"https://github.com/babashka/babashka/releases/download/''${latest_version}/babashka-''${latest_version/v/}-standalone.jar" \
67
+
| bsdtar -qxOf - borkdude/deps.clj \
68
+
| ${babashka-unwrapped}/bin/bb -I -o -e "(or (some->> *input* (filter #(= '(def version) (take 2 %))) first last last last) (throw (ex-info \"Couldn't find expected '(def version ...)' form in 'borkdude/deps.clj'.\" {})))")
58
-
update-source-version babashka "''${latest_version/v/}"
70
+
update-source-version babashka.clojure-tools "$clojure_tools_version" \
71
+
--file="pkgs/development/interpreters/babashka/clojure-tools.nix"
62
-
description = "A Clojure babushka for the grey areas of Bash";
63
-
longDescription = ''
64
-
The main idea behind babashka is to leverage Clojure in places where you
65
-
would be using bash otherwise.
75
+
description = "A Clojure babushka for the grey areas of Bash";
76
+
longDescription = ''
77
+
The main idea behind babashka is to leverage Clojure in places where you
78
+
would be using bash otherwise.
67
-
As one user described it:
80
+
As one user described it:
69
-
I’m quite at home in Bash most of the time, but there’s a substantial
70
-
grey area of things that are too complicated to be simple in bash, but
71
-
too simple to be worth writing a clj/s script for. Babashka really
72
-
seems to hit the sweet spot for those cases.
82
+
I’m quite at home in Bash most of the time, but there’s a substantial
83
+
grey area of things that are too complicated to be simple in bash, but
84
+
too simple to be worth writing a clj/s script for. Babashka really
85
+
seems to hit the sweet spot for those cases.
76
-
- Low latency Clojure scripting alternative to JVM Clojure.
77
-
- Easy installation: grab the self-contained binary and run. No JVM needed.
78
-
- Familiarity and portability:
79
-
- Scripts should be compatible with JVM Clojure as much as possible
80
-
- Scripts should be platform-independent as much as possible. Babashka
81
-
offers support for linux, macOS and Windows.
82
-
- Allow interop with commonly used classes like java.io.File and System
83
-
- Multi-threading support (pmap, future, core.async)
84
-
- Batteries included (tools.cli, cheshire, ...)
85
-
- Library support via popular tools like the clojure CLI
87
-
homepage = "https://github.com/babashka/babashka";
88
-
changelog = "https://github.com/babashka/babashka/blob/v${version}/CHANGELOG.md";
89
-
sourceProvenance = with sourceTypes; [ binaryBytecode ];
90
-
license = licenses.epl10;
91
-
maintainers = with maintainers; [
89
+
- Low latency Clojure scripting alternative to JVM Clojure.
90
+
- Easy installation: grab the self-contained binary and run. No JVM needed.
91
+
- Familiarity and portability:
92
+
- Scripts should be compatible with JVM Clojure as much as possible
93
+
- Scripts should be platform-independent as much as possible. Babashka
94
+
offers support for linux, macOS and Windows.
95
+
- Allow interop with commonly used classes like java.io.File and System
96
+
- Multi-threading support (pmap, future, core.async)
97
+
- Batteries included (tools.cli, cheshire, ...)
98
+
- Library support via popular tools like the clojure CLI
100
+
homepage = "https://github.com/babashka/babashka";
101
+
changelog = "https://github.com/babashka/babashka/blob/v${version}/CHANGELOG.md";
102
+
sourceProvenance = with sourceTypes; [ binaryBytecode ];
103
+
license = licenses.epl10;
104
+
maintainers = with maintainers; [