2020-06-16 21:39:39 +02:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, coursier
|
|
|
|
, autoPatchelfHook
|
|
|
|
, lib
|
|
|
|
, zlib
|
|
|
|
}:
|
2018-06-03 21:48:05 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bloop";
|
2020-05-21 16:47:18 +02:00
|
|
|
version = "1.4.1";
|
2019-06-15 12:11:40 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
bloop-coursier-channel = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bloop-coursier.json";
|
|
|
|
sha256 = "2e6a873183e5e22712913bfdab1331d0a7792167c369fee5be0c83e27572fe12";
|
2019-07-24 15:39:08 +02:00
|
|
|
};
|
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
bloop-bash = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bash-completions";
|
|
|
|
sha256 = "da6b7ecd4109bd0ff98b1c452d9dd9d26eee0d28ff604f6c83fb8d3236a6bdd1";
|
|
|
|
};
|
2019-07-24 15:39:08 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
bloop-fish = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/fish-completions";
|
|
|
|
sha256 = "1pa8h81l2498q8dbd83fzipr99myjwxpy8xdgzhvqzdmfv6aa4m0";
|
2018-06-03 21:48:05 +02:00
|
|
|
};
|
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
bloop-zsh = fetchurl {
|
|
|
|
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/zsh-completions";
|
|
|
|
sha256 = "1xzg0qfkjdmzm3mvg82mc4iia8cl7b6vbl8ng4ir2xsz00zjrlsq";
|
|
|
|
};
|
2019-06-15 12:11:40 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
bloop-coursier = stdenv.mkDerivation {
|
|
|
|
name = "${pname}-coursier-${version}";
|
2019-06-15 12:11:40 +02:00
|
|
|
|
|
|
|
phases = [ "installPhase" ];
|
2020-06-16 21:39:39 +02:00
|
|
|
installPhase = ''
|
|
|
|
export COURSIER_CACHE=$(pwd)
|
|
|
|
export COURSIER_JVM_CACHE=$(pwd)
|
|
|
|
|
|
|
|
mkdir channel
|
|
|
|
ln -s ${bloop-coursier-channel} channel/bloop.json
|
|
|
|
${coursier}/bin/coursier install --install-dir $out --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
|
|
|
|
'';
|
2019-06-15 12:11:40 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHash = "17jskljn0aspvl7s2hadzjmp05blnsrxi8db8pn3lfw40da4yn79";
|
2018-06-03 21:48:05 +02:00
|
|
|
};
|
2019-06-15 12:11:40 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
nativeBuildInputs = [ autoPatchelfHook ] ;
|
|
|
|
phases = [ "installPhase" "fixupPhase" ];
|
|
|
|
buildInputs = [ stdenv.cc.cc.lib zlib ] ;
|
2018-06-03 21:48:05 +02:00
|
|
|
|
|
|
|
installPhase = ''
|
2020-06-16 21:39:39 +02:00
|
|
|
export COURSIER_CACHE=$(pwd)
|
|
|
|
export COURSIER_JVM_CACHE=$(pwd)
|
|
|
|
|
2018-06-03 21:48:05 +02:00
|
|
|
mkdir -p $out/bin
|
2020-06-16 21:39:39 +02:00
|
|
|
cp ${bloop-coursier}/bloop $out/bloop
|
|
|
|
cp ${bloop-coursier}/.bloop.aux $out/.bloop.aux
|
|
|
|
ln -s $out/bloop $out/bin/bloop
|
2018-06-03 21:48:05 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
# patch the bloop launcher so that it works when symlinked
|
|
|
|
sed "s|\$(dirname \"\$0\")|$out|" -i $out/bloop
|
2018-06-03 21:48:05 +02:00
|
|
|
|
2020-06-16 21:39:39 +02:00
|
|
|
#Install completions
|
|
|
|
mkdir -p $out/etc/bash_completion.d
|
|
|
|
ln -s ${bloop-bash} $out/etc/bash_completion.d/bloop
|
|
|
|
mkdir -p $out/share/zsh/site-functions
|
|
|
|
ln -s ${bloop-zsh} $out/share/zsh/site-functions/_bloop
|
|
|
|
mkdir -p $out/usr/share/fish/vendor_completions.d/
|
|
|
|
ln -s ${bloop-fish} $out/usr/share/fish/vendor_completions.d/bloop.fish
|
2018-06-03 21:48:05 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://scalacenter.github.io/bloop/";
|
2018-06-03 21:48:05 +02:00
|
|
|
license = licenses.asl20;
|
|
|
|
description = "Bloop is 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.";
|
|
|
|
maintainers = with maintainers; [ tomahna ];
|
|
|
|
};
|
|
|
|
}
|