2020-04-21 23:07:41 +01:00
|
|
|
|
{ stdenv, fetchurl, graalvm8, glibcLocales }:
|
2020-04-04 22:20:32 +01:00
|
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "babashka";
|
2020-04-24 18:44:19 +01:00
|
|
|
|
version = "0.0.89";
|
2020-04-04 22:20:32 +01:00
|
|
|
|
|
|
|
|
|
reflectionJson = fetchurl {
|
|
|
|
|
name = "reflection.json";
|
|
|
|
|
url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-reflection.json";
|
2020-04-24 18:44:19 +01:00
|
|
|
|
sha256 = "0bc5rbizd2lg7qfh733yiip8m9zqrwgjf5ca09sdibxp7nhhsjby";
|
2020-04-04 22:20:32 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
|
url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
|
2020-04-24 18:44:19 +01:00
|
|
|
|
sha256 = "11jhqbm3svvikr9glz8wwps1267y25g3384ijw6avn267s7d7l8c";
|
2020-04-04 22:20:32 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
2020-04-21 23:07:41 +01:00
|
|
|
|
LC_ALL = "en_US.UTF-8";
|
|
|
|
|
nativeBuildInputs = [ graalvm8 glibcLocales ];
|
2020-04-04 22:20:32 +01:00
|
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
|
native-image \
|
|
|
|
|
-jar ${src} \
|
|
|
|
|
-H:Name=bb \
|
|
|
|
|
-H:+ReportExceptionStackTraces \
|
|
|
|
|
-J-Dclojure.spec.skip-macros=true \
|
|
|
|
|
-J-Dclojure.compiler.direct-linking=true \
|
|
|
|
|
"-H:IncludeResources=BABASHKA_VERSION" \
|
|
|
|
|
"-H:IncludeResources=SCI_VERSION" \
|
|
|
|
|
-H:ReflectionConfigurationFiles=${reflectionJson} \
|
|
|
|
|
--initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \
|
|
|
|
|
--initialize-at-build-time \
|
|
|
|
|
-H:Log=registerResource: \
|
|
|
|
|
-H:EnableURLProtocols=http,https \
|
|
|
|
|
--enable-all-security-services \
|
|
|
|
|
-H:+JNI \
|
|
|
|
|
--verbose \
|
|
|
|
|
--no-fallback \
|
|
|
|
|
--no-server \
|
|
|
|
|
--report-unsupported-elements-at-runtime \
|
2020-04-24 18:44:19 +01:00
|
|
|
|
"--initialize-at-run-time=org.postgresql.sspi.SSPIClient" \
|
2020-04-25 09:00:29 +01:00
|
|
|
|
"-J-Xmx4500m"
|
2020-04-04 22:20:32 +01:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
cp bb $out/bin/bb
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
|
description = "A Clojure babushka for the grey areas of Bash";
|
|
|
|
|
longDescription = ''
|
|
|
|
|
The main idea behind babashka is to leverage Clojure in places where you
|
|
|
|
|
would be using bash otherwise.
|
|
|
|
|
|
|
|
|
|
As one user described it:
|
|
|
|
|
|
|
|
|
|
I’m quite at home in Bash most of the time, but there’s 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
|
|
|
|
|
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
|
|
|
|
|
- Scripts should be platform-independent as much as possible. Babashka
|
|
|
|
|
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
|
|
|
|
|
'';
|
|
|
|
|
homepage = "https://github.com/borkdude/babashka";
|
|
|
|
|
license = licenses.epl10;
|
|
|
|
|
platforms = graalvm8.meta.platforms;
|
|
|
|
|
maintainers = with maintainers; [ bhougland DerGuteMoritz jlesquembre ];
|
|
|
|
|
};
|
|
|
|
|
}
|