2020-08-20 17:08:02 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, coursier
|
|
|
|
, autoPatchelfHook
|
|
|
|
, installShellFiles
|
|
|
|
, jre
|
|
|
|
, lib
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bloop";
|
2020-09-25 04:45:31 +00:00
|
|
|
version = "1.4.4";
|
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";
|
2020-09-25 04:45:31 +00:00
|
|
|
sha256 = "1pyf559bpnsmvca4kw36nb9lwkwa9q0ghrpa117s96dhvrp3i2bv";
|
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";
|
|
|
|
sha256 = "1ldxlqv353gvhdn4yq7z506ywvnjv6fjsi8wigwhzg89876pwsys";
|
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";
|
|
|
|
sha256 = "1pa8h81l2498q8dbd83fzipr99myjwxpy8xdgzhvqzdmfv6aa4m0";
|
|
|
|
};
|
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";
|
|
|
|
sha256 = "1xzg0qfkjdmzm3mvg82mc4iia8cl7b6vbl8ng4ir2xsz00zjrlsq";
|
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"
|
|
|
|
else if stdenv.isDarwin && stdenv.isx86_64 then "x86_64-apple-darwin"
|
|
|
|
else throw "unsupported platform";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
phases = [ "installPhase" ];
|
2020-08-20 17:08:02 +00:00
|
|
|
installPhase = ''
|
|
|
|
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
|
|
|
|
${coursier}/bin/coursier install --install-dir $out --install-platform ${platform} --default-channels=false --channel channel --only-prebuilt=true bloop
|
|
|
|
|
|
|
|
# Remove binary part of the coursier launcher script to make derivation output hash stable
|
|
|
|
sed -i '5,$ d' $out/bloop
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2020-09-25 04:45:31 +00:00
|
|
|
outputHash = if stdenv.isLinux && stdenv.isx86_64 then "0hf0priy93zqba78a9nvbgl3mzwlc4jz43gz7cv2cdkj6x0lp0y1"
|
|
|
|
else if stdenv.isDarwin && stdenv.isx86_64 then "0g2rnmlfnqymji4f4rn0kaz7hipgv3bakdpn08600gg1f3s8gabw"
|
2020-08-20 17:08:02 +00:00
|
|
|
else throw "unsupported platform";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
dontUnpack = true;
|
|
|
|
nativeBuildInputs = [ autoPatchelfHook installShellFiles ];
|
|
|
|
buildInputs = [ stdenv.cc.cc.lib zlib ];
|
|
|
|
propagatedBuildInputs = [ jre ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
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
|
|
|
mkdir -p $out/bin
|
2020-08-20 17:08:02 +00:00
|
|
|
cp ${bloop-coursier}/bloop $out/bloop
|
|
|
|
cp ${bloop-coursier}/.bloop.aux $out/.bloop.aux
|
|
|
|
ln -s $out/bloop $out/bin/bloop
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
# patch the bloop launcher so that it works when symlinked
|
|
|
|
sed "s|\$(dirname \"\$0\")|$out|" -i $out/bloop
|
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}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
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" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ tomahna ];
|
|
|
|
};
|
|
|
|
}
|