1{ stdenv
2, fetchurl
3, autoPatchelfHook
4, installShellFiles
5, makeWrapper
6, jre
7, lib
8, zlib
9}:
10
11stdenv.mkDerivation rec {
12 pname = "bloop";
13 version = "1.5.17";
14
15 platform =
16 if stdenv.isLinux && stdenv.isx86_64 then "x86_64-pc-linux"
17 else if stdenv.isDarwin && stdenv.isx86_64 then "x86_64-apple-darwin"
18 else throw "unsupported platform";
19
20 bloop-bash = fetchurl {
21 url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bash-completions";
22 sha256 = "sha256-2mt+zUEJvQ/5ixxFLZ3Z0m7uDSj/YE9sg/uNMjamvdE=";
23 };
24
25 bloop-fish = fetchurl {
26 url = "https://github.com/scalacenter/bloop/releases/download/v${version}/fish-completions";
27 sha256 = "sha256-eFESR6iPHRDViGv+Fk3sCvPgVAhk2L1gCG4LnfXO/v4=";
28 };
29
30 bloop-zsh = fetchurl {
31 url = "https://github.com/scalacenter/bloop/releases/download/v${version}/zsh-completions";
32 sha256 = "sha256-WNMsPwBfd5EjeRbRtc06lCEVI2FVoLfrqL82OR0G7/c=";
33 };
34
35 bloop-binary = fetchurl rec {
36 url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bloop-${platform}";
37 sha256 =
38 if stdenv.isLinux && stdenv.isx86_64 then "sha256-lP7j7pPG7wC36sG+d80F2E6ZHPZcOZN/M/j6CniaNGY="
39 else if stdenv.isDarwin && stdenv.isx86_64 then "sha256-awSBYSN4do4w9dAx6JwoexiptfC01vW1/o53Tp13xj0="
40 else throw "unsupported platform";
41 };
42
43 dontUnpack = true;
44 nativeBuildInputs = [ installShellFiles makeWrapper ]
45 ++ lib.optional stdenv.isLinux autoPatchelfHook;
46 buildInputs = [ stdenv.cc.cc.lib zlib ];
47 propagatedBuildInputs = [ jre ];
48
49 installPhase = ''
50 runHook preInstall
51
52 install -D -m 0755 ${bloop-binary} $out/.bloop-wrapped
53
54 makeWrapper $out/.bloop-wrapped $out/bin/bloop
55
56 #Install completions
57 installShellCompletion --name bloop --bash ${bloop-bash}
58 installShellCompletion --name _bloop --zsh ${bloop-zsh}
59 installShellCompletion --name bloop.fish --fish ${bloop-fish}
60
61 runHook postInstall
62 '';
63
64 meta = with lib; {
65 homepage = "https://scalacenter.github.io/bloop/";
66 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
67 license = licenses.asl20;
68 description = "A Scala build server and command-line tool to make the compile and test developer workflows fast and productive in a build-tool-agnostic way";
69 mainProgram = "bloop";
70 platforms = [ "x86_64-linux" "x86_64-darwin" ];
71 maintainers = with maintainers; [ kubukoz tomahna ];
72 };
73}