diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 6d24ff60f70a..6ca474d67ef9 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -981,6 +981,12 @@ githubId = 2071583; name = "Benjamin Hipple"; }; + bhougland = { + email = "benjamin.hougland@gmail.com"; + github = "bhougland18"; + githubId = 28444296; + name = "Benjamin Hougland"; + }; binarin = { email = "binarin@binarin.ru"; github = "binarin"; diff --git a/pkgs/development/interpreters/clojure/babashka.nix b/pkgs/development/interpreters/clojure/babashka.nix new file mode 100644 index 000000000000..db849bb542de --- /dev/null +++ b/pkgs/development/interpreters/clojure/babashka.nix @@ -0,0 +1,82 @@ +{ stdenv, fetchurl, graalvm8 }: + +with stdenv.lib; +stdenv.mkDerivation rec { + pname = "babashka"; + version = "0.0.78"; + + reflectionJson = fetchurl { + name = "reflection.json"; + url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-reflection.json"; + sha256 = "1m1nwdxjsc6bkdzkbsll316ly0c3qxaimjzyfph1220irjxnm7xf"; + }; + + src = fetchurl { + url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar"; + sha256 = "01w990zk5qjrbnc846snh6na002kdyrlrfnqwg03ibx20g3mr7if"; + }; + + dontUnpack = true; + + buildInputs = [ graalvm8 ]; + + 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 \ + "-J-Xmx3g" + ''; + + 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 ]; + }; +} diff --git a/pkgs/tools/misc/babashka/default.nix b/pkgs/tools/misc/babashka/default.nix deleted file mode 100644 index bef5c334c7c6..000000000000 --- a/pkgs/tools/misc/babashka/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ stdenv, fetchurl, graalvm8 } : - -stdenv.mkDerivation rec { - pname = "babashka"; - version = "0.0.71"; - - src = fetchurl { - url = "https://github.com/borkdude/babashka/releases/download/v${version}/babashka-${version}-standalone.jar"; - sha256 = "0gyahrxrvyfkvqg4dhzx81mg2hw56ji3aa1yxb9ycwa5bawb6080"; - }; - - reflectionJson = fetchurl { - url = "https://github.com/borkdude/babashka/releases/download/v${version}/reflection.json"; - sha256 = "13p1yw27sjvfi130pw7m9c1yzdgh7wxh8r6z8b4qmr3iifidfrcr"; - }; - - dontUnpack = true; - - buildInputs = [ graalvm8 ]; - - 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 \ - -J-Xmx3g - ''; - - installPhase = '' - mkdir -p $out/bin - cp bb $out/bin - ''; - - meta = with stdenv.lib; { - description = "Tool for executing Clojure snippets or scripts in the same space where you would use Bash"; - homepage = "https://github.com/borkdude/babashka/"; - license = licenses.epl10; - platforms = graalvm8.meta.platforms; - maintainers = with maintainers; [ DerGuteMoritz ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f898c91d42b6..0f4475821215 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -792,8 +792,6 @@ in automirror = callPackage ../tools/misc/automirror { }; - babashka = callPackage ../tools/misc/babashka { }; - bash-my-aws = callPackage ../tools/admin/bash-my-aws { }; bcachefs-tools = callPackage ../tools/filesystems/bcachefs-tools { }; @@ -9198,6 +9196,8 @@ in angelscript_2_22 = callPackage ../development/interpreters/angelscript/2.22.nix {}; + babashka = callPackage ../development/interpreters/clojure/babashka.nix { }; + chibi = callPackage ../development/interpreters/chibi { }; ceptre = callPackage ../development/interpreters/ceptre { };