summary refs log tree commit diff
path: root/pkgs/development/interpreters/clojure
diff options
context:
space:
mode:
authorWill Cohen <willcohen@users.noreply.github.com>2022-01-04 15:29:32 -0500
committerWill Cohen <willcohen@users.noreply.github.com>2022-01-04 17:43:04 -0500
commit3951393fe99d137fb11e6651dbe1450e15e9da4c (patch)
treed8e90b871cc52961d0471bd2da4b09d58cd5f8e0 /pkgs/development/interpreters/clojure
parentfda6ac57097d559d2581fa3213ef944c74e04bfa (diff)
downloadnixpkgs-3951393fe99d137fb11e6651dbe1450e15e9da4c.tar
nixpkgs-3951393fe99d137fb11e6651dbe1450e15e9da4c.tar.gz
nixpkgs-3951393fe99d137fb11e6651dbe1450e15e9da4c.tar.bz2
nixpkgs-3951393fe99d137fb11e6651dbe1450e15e9da4c.tar.lz
nixpkgs-3951393fe99d137fb11e6651dbe1450e15e9da4c.tar.xz
nixpkgs-3951393fe99d137fb11e6651dbe1450e15e9da4c.tar.zst
nixpkgs-3951393fe99d137fb11e6651dbe1450e15e9da4c.zip
obb: init at 0.0.1
Diffstat (limited to 'pkgs/development/interpreters/clojure')
-rw-r--r--pkgs/development/interpreters/clojure/obb.nix79
1 files changed, 79 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/clojure/obb.nix b/pkgs/development/interpreters/clojure/obb.nix
new file mode 100644
index 00000000000..3e0a63b5e28
--- /dev/null
+++ b/pkgs/development/interpreters/clojure/obb.nix
@@ -0,0 +1,79 @@
+{ lib
+, stdenv
+, fetchurl
+, babashka
+, cacert
+, clojure
+, git
+, jdk
+, callPackage
+, makeWrapper
+, runCommand }:
+
+stdenv.mkDerivation rec {
+  pname = "obb";
+  version = "0.0.1";
+
+  src = fetchurl {
+    url = "https://github.com/babashka/${pname}/archive/refs/tags/v${version}.tar.gz";
+    sha256 = "sha256-ZVd3VCJ7vdQGQ7iY5v2b+gRX/Ni0/03hzqBElqpPvpI=";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  buildInputs = [ babashka cacert git jdk ];
+
+  configurePhase = ''
+    runHook preConfigure
+
+    mkdir -p .m2
+    substituteInPlace deps.edn --replace ':paths' ':mvn/local-repo "./.m2" :paths'
+    substituteInPlace bb.edn --replace ':paths' ':mvn/local-repo "./.m2" :paths'
+    echo deps.edn
+
+    runHook postConfigure
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+
+    export DEPS_CLJ_TOOLS_DIR=${clojure}
+    export DEPS_CLJ_TOOLS_VERSION=${clojure.version}
+    mkdir -p .gitlibs
+    mkdir -p .cpcache
+    export GITLIBS=.gitlibs
+    export CLJ_CACHE=.cpcache
+
+    bb build
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin
+    ln -s /usr/bin/osascript $out/bin/osascript
+
+    install -Dm755 "out/bin/obb" "$out/bin/obb"
+    wrapProgram $out/bin/obb --prefix PATH : $out/bin
+
+    runHook postInstall
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    [ $($out/bin/obb -e '(+ 1 2)') = '3' ]
+  '';
+
+
+  meta = with lib; {
+    description = "Ad-hoc ClojureScript scripting of Mac applications via Apple's Open Scripting Architecture";
+    homepage = "https://github.com/babashka/obb";
+    license = licenses.epl10;
+    maintainers = with maintainers; [
+      willcohen
+    ];
+    platforms = platforms.darwin;
+  };
+}