nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

babashka: Add wrapper

To resolve dependecies in `bb.edn` files, Babashka depends on some
Clojure files and Java, see:
https://github.com/borkdude/deps.clj/tree/master#deps_clj_tools_dir

The wrapper also adds rlwrap, as recommended in the Babashka
documentation:
https://book.babashka.org/#_repl

I'm also formatting the file with nixpkgs-fmt

+63 -22
+35
pkgs/development/interpreters/babashka/wrapped.nix
··· 1 + { stdenv 2 + , babashka-unwrapped 3 + , clojure 4 + , makeWrapper 5 + , rlwrap 6 + 7 + , jdkBabashka ? clojure.jdk 8 + }: 9 + stdenv.mkDerivation (finalAttrs: { 10 + pname = "babashka"; 11 + inherit (babashka-unwrapped) version meta doInstallCheck installCheckPhase; 12 + 13 + dontUnpack = true; 14 + dontBuild = true; 15 + 16 + nativeBuildInputs = [ makeWrapper ]; 17 + 18 + installPhase = 19 + let unwrapped-bin = "${babashka-unwrapped}/bin/bb"; in 20 + '' 21 + mkdir -p $out/clojure_tools 22 + ln -s -t $out/clojure_tools ${clojure}/*.edn 23 + ln -s -t $out/clojure_tools ${clojure}/libexec/* 24 + 25 + makeWrapper "${babashka-unwrapped}/bin/bb" "$out/bin/bb" \ 26 + --inherit-argv0 \ 27 + --set-default DEPS_CLJ_TOOLS_DIR $out/clojure_tools \ 28 + --set-default JAVA_HOME ${jdkBabashka} 29 + 30 + substituteInPlace $out/bin/bb \ 31 + --replace '"${unwrapped-bin}"' '"${rlwrap}/bin/rlwrap" "${unwrapped-bin}"' 32 + ''; 33 + 34 + passthru.unwrapped = babashka-unwrapped; 35 + })
+17 -14
pkgs/development/interpreters/clojure/babashka.nix pkgs/development/interpreters/babashka/default.nix
··· 3 3 , graalvmCEPackages 4 4 , removeReferencesTo 5 5 , fetchurl 6 - , writeScript }: 6 + , writeScript 7 + }: 7 8 8 9 buildGraalvmNativeImage rec { 9 - pname = "babashka"; 10 + pname = "babashka-unwrapped"; 10 11 version = "1.3.181"; 11 12 12 13 src = fetchurl { 13 - url = "https://github.com/babashka/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar"; 14 + url = "https://github.com/babashka/babashka/releases/download/v${version}/babashka-${version}-standalone.jar"; 14 15 sha256 = "sha256-NzchlHRxOCSyUf9U0Jv8h4bgKd2Jwp+LmxIfeV8+8+M="; 15 16 }; 16 17 ··· 27 26 "--native-image-info" 28 27 "--enable-preview" 29 28 ]; 29 + 30 + doInstallCheck = true; 30 31 31 32 installCheckPhase = '' 32 33 $out/bin/bb --version | grep '${version}' ··· 71 68 too simple to be worth writing a clj/s script for. Babashka really 72 69 seems to hit the sweet spot for those cases. 73 70 74 - Goals: 71 + Goals: 75 72 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 73 + - Low latency Clojure scripting alternative to JVM Clojure. 74 + - Easy installation: grab the self-contained binary and run. No JVM needed. 75 + - Familiarity and portability: 76 + - Scripts should be compatible with JVM Clojure as much as possible 77 + - Scripts should be platform-independent as much as possible. Babashka 78 + offers support for linux, macOS and Windows. 79 + - Allow interop with commonly used classes like java.io.File and System 80 + - Multi-threading support (pmap, future, core.async) 81 + - Batteries included (tools.cli, cheshire, ...) 82 + - Library support via popular tools like the clojure CLI 86 83 ''; 87 84 homepage = "https://github.com/babashka/babashka"; 88 85 changelog = "https://github.com/babashka/babashka/blob/v${version}/CHANGELOG.md";
+2
pkgs/development/interpreters/clojure/default.nix
··· 71 71 update-source-version clojure "$latest_version" 72 72 ''; 73 73 74 + passthru.jdk = jdk; 75 + 74 76 meta = with lib; { 75 77 description = "A Lisp dialect for the JVM"; 76 78 homepage = "https://clojure.org/";
+3 -1
pkgs/development/interpreters/clojure/obb.nix
··· 1 1 { lib 2 2 , stdenv 3 - , fetchurl 4 3 , babashka 5 4 , cacert 6 5 , clojure ··· 78 79 willcohen 79 80 ]; 80 81 platforms = platforms.darwin; 82 + 83 + # https://hydra.nixos.org/job/nixpkgs/trunk/obb.aarch64-darwin/all 84 + broken = true; 81 85 }; 82 86 }
+3 -4
pkgs/development/tools/bbin/default.nix
··· 2 2 , stdenvNoCC 3 3 , fetchFromGitHub 4 4 , makeWrapper 5 - , babashka 6 - , graalvm17-ce 5 + , babashka-unwrapped 7 6 }: 8 7 9 8 stdenvNoCC.mkDerivation rec { ··· 28 29 mkdir -p $out/share 29 30 cp -r docs $out/share/docs 30 31 wrapProgram $out/bin/bbin \ 31 - --prefix PATH : "${lib.makeBinPath [ babashka babashka.graalvmDrv ]}" 32 + --prefix PATH : "${lib.makeBinPath [ babashka-unwrapped babashka-unwrapped.graalvmDrv ]}" 32 33 33 34 runHook postInstall 34 35 ''; ··· 37 38 homepage = "https://github.com/babashka/bbin"; 38 39 description = "Install any Babashka script or project with one command"; 39 40 license = licenses.mit; 40 - inherit (babashka.meta) platforms; 41 + inherit (babashka-unwrapped.meta) platforms; 41 42 maintainers = with maintainers; [ sohalt ]; 42 43 }; 43 44 }
+1 -2
pkgs/development/tools/neil/default.nix
··· 3 3 , fetchFromGitHub 4 4 , makeWrapper 5 5 , babashka 6 - , jdk 7 6 }: 8 7 9 8 stdenv.mkDerivation rec { ··· 23 24 installPhase = '' 24 25 install -D neil $out/bin/neil 25 26 wrapProgram $out/bin/neil \ 26 - --prefix PATH : "${lib.makeBinPath [ babashka jdk ]}" 27 + --prefix PATH : "${lib.makeBinPath [ babashka ]}" 27 28 ''; 28 29 29 30 meta = with lib; {
+2 -1
pkgs/top-level/all-packages.nix
··· 17108 17108 17109 17109 angelscript = callPackage ../development/interpreters/angelscript { }; 17110 17110 17111 - babashka = callPackage ../development/interpreters/clojure/babashka.nix { }; 17111 + babashka-unwrapped = callPackage ../development/interpreters/babashka { }; 17112 + babashka = callPackage ../development/interpreters/babashka/wrapped.nix { }; 17112 17113 17113 17114 # BQN interpreters and compilers 17114 17115