2020-08-20 17:08:02 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, coursier
|
|
|
|
, autoPatchelfHook
|
|
|
|
, installShellFiles
|
2021-12-06 16:07:01 +00:00
|
|
|
, makeWrapper
|
2020-08-20 17:08:02 +00:00
|
|
|
, jre
|
|
|
|
, lib
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bloop";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "1.4.11";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
bloop-coursier-channel = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bloop-coursier.json";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "CoF/1nggjaL17SWmWDcKicfgoyqpOSZUse8f+3TgD0E=";
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
bloop-bash = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bash-completions";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "2mt+zUEJvQ/5ixxFLZ3Z0m7uDSj/YE9sg/uNMjamvdE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
bloop-fish = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/fish-completions";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "oBKlzHa1fbzhf60jfzuXvqaUb/xuoLYawigRQQOCSN0=";
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
bloop-zsh = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/zsh-completions";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "WNMsPwBfd5EjeRbRtc06lCEVI2FVoLfrqL82OR0G7/c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
bloop-coursier = stdenv.mkDerivation rec {
|
|
|
|
name = "${pname}-coursier-${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
platform = if stdenv.isLinux && stdenv.isx86_64 then "x86_64-pc-linux"
|
2021-12-06 16:07:01 +00:00
|
|
|
else if stdenv.isDarwin && stdenv.isx86_64 then "x86_64-apple-darwin"
|
|
|
|
else throw "unsupported platform";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
dontUnpack = true;
|
2020-08-20 17:08:02 +00:00
|
|
|
installPhase = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
export COURSIER_CACHE=$(pwd)
|
|
|
|
export COURSIER_JVM_CACHE=$(pwd)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
mkdir channel
|
|
|
|
ln -s ${bloop-coursier-channel} channel/bloop.json
|
2021-12-06 16:07:01 +00:00
|
|
|
${coursier}/bin/cs install --install-dir . --install-platform ${platform} --default-channels=false --channel channel --only-prebuilt=true bloop
|
|
|
|
|
|
|
|
# Only keeping the binary, we'll wrap it ourselves
|
|
|
|
# This guarantees the output of this fixed-output derivation doesn't have references to itself
|
|
|
|
install -D -m 0755 .bloop.aux $out
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2021-12-06 16:07:01 +00:00
|
|
|
outputHash = if stdenv.isLinux && stdenv.isx86_64 then "0c02n779z4l7blzla5820bzfhblbp5nlizx9f8wns4miwnph357f"
|
|
|
|
else if stdenv.isDarwin && stdenv.isx86_64 then "1gy5k9ii86rxyv2v9if4n1clvmb1hi4ym32mp6miwgcjla10sv30"
|
|
|
|
else throw "unsupported platform";
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
dontUnpack = true;
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [ autoPatchelfHook installShellFiles makeWrapper ];
|
2020-08-20 17:08:02 +00:00
|
|
|
buildInputs = [ stdenv.cc.cc.lib zlib ];
|
|
|
|
propagatedBuildInputs = [ jre ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
export COURSIER_CACHE=$(pwd)
|
|
|
|
export COURSIER_JVM_CACHE=$(pwd)
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
install -D -m 0755 ${bloop-coursier} $out/.bloop-wrapped
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
makeWrapper $out/.bloop-wrapped $out/bin/bloop \
|
|
|
|
--set CS_NATIVE_LAUNCHER true \
|
|
|
|
--set IS_CS_INSTALLED_LAUNCHER true
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
#Install completions
|
|
|
|
installShellCompletion --name bloop --bash ${bloop-bash}
|
|
|
|
installShellCompletion --name _bloop --zsh ${bloop-zsh}
|
|
|
|
installShellCompletion --name bloop.fish --fish ${bloop-fish}
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://scalacenter.github.io/bloop/";
|
|
|
|
license = licenses.asl20;
|
2020-11-03 02:18:15 +00:00
|
|
|
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";
|
2020-08-20 17:08:02 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ kubukoz tomahna ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|