nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 83 lines 1.7 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, babashka 5, cacert 6, clojure 7, git 8, jdk 9, obb 10, fetchFromGitHub 11, makeWrapper 12, runCommand }: 13 14stdenv.mkDerivation rec { 15 pname = "obb"; 16 version = "0.0.2"; 17 18 src = fetchFromGitHub { 19 owner = "babashka"; 20 repo = pname; 21 rev = "v${version}"; 22 sha256 = "1Gxh4IMtytQCuPS+BWOc5AgjEBxa43ebYfDsxLSPeY0="; 23 }; 24 25 nativeBuildInputs = [ makeWrapper ]; 26 27 buildInputs = [ babashka cacert git jdk ]; 28 29 configurePhase = '' 30 runHook preConfigure 31 32 mkdir -p .m2 33 substituteInPlace deps.edn --replace ':paths' ':mvn/local-repo "./.m2" :paths' 34 substituteInPlace bb.edn --replace ':paths' ':mvn/local-repo "./.m2" :paths' 35 echo deps.edn 36 37 runHook postConfigure 38 ''; 39 40 buildPhase = '' 41 runHook preBuild 42 43 export DEPS_CLJ_TOOLS_DIR=${clojure} 44 export DEPS_CLJ_TOOLS_VERSION=${clojure.version} 45 mkdir -p .gitlibs 46 mkdir -p .cpcache 47 export GITLIBS=.gitlibs 48 export CLJ_CACHE=.cpcache 49 50 bb build 51 52 runHook postBuild 53 ''; 54 55 installPhase = '' 56 runHook preInstall 57 58 mkdir -p $out/bin 59 ln -s /usr/bin/osascript $out/bin/osascript 60 61 install -Dm755 "out/bin/obb" "$out/bin/obb" 62 wrapProgram $out/bin/obb --prefix PATH : $out/bin 63 64 runHook postInstall 65 ''; 66 67 passthru.tests = { 68 simple = runCommand "${pname}-test" {} '' 69 [ $(${obb}/bin/obb -e '(+ 1 2)') = '3' ] 70 touch $out 71 ''; 72 }; 73 74 meta = with lib; { 75 description = "Ad-hoc ClojureScript scripting of Mac applications via Apple's Open Scripting Architecture"; 76 homepage = "https://github.com/babashka/obb"; 77 license = licenses.epl10; 78 maintainers = with maintainers; [ 79 willcohen 80 ]; 81 platforms = platforms.darwin; 82 }; 83}