Skip to content

Commit

Permalink
bloop: 1.4.9 -> 1.4.11
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz authored and jonringer committed Dec 3, 2021
1 parent 24d7173 commit 305b7de
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions pkgs/development/tools/build-managers/bloop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,91 @@
, coursier
, autoPatchelfHook
, installShellFiles
, makeWrapper
, jre
, lib
, zlib
}:

stdenv.mkDerivation rec {
pname = "bloop";
version = "1.4.9";
version = "1.4.11";

bloop-coursier-channel = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bloop-coursier.json";
sha256 = "0yh9k98c0cq9ksi3g6rb1q1qblnhcznrc5z1y9ps8cvwv2lx8ly4";
sha256 = "CoF/1nggjaL17SWmWDcKicfgoyqpOSZUse8f+3TgD0E=";
};

bloop-bash = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bash-completions";
sha256 = "1ldxlqv353gvhdn4yq7z506ywvnjv6fjsi8wigwhzg89876pwsys";
sha256 = "2mt+zUEJvQ/5ixxFLZ3Z0m7uDSj/YE9sg/uNMjamvdE=";
};

bloop-fish = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/fish-completions";
sha256 = "1pa8h81l2498q8dbd83fzipr99myjwxpy8xdgzhvqzdmfv6aa4m0";
sha256 = "oBKlzHa1fbzhf60jfzuXvqaUb/xuoLYawigRQQOCSN0=";
};

bloop-zsh = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/zsh-completions";
sha256 = "1xzg0qfkjdmzm3mvg82mc4iia8cl7b6vbl8ng4ir2xsz00zjrlsq";
sha256 = "WNMsPwBfd5EjeRbRtc06lCEVI2FVoLfrqL82OR0G7/c=";
};

bloop-coursier = stdenv.mkDerivation rec {
name = "${pname}-coursier-${version}";

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";
else if stdenv.isDarwin && stdenv.isx86_64 then "x86_64-apple-darwin"
else throw "unsupported platform";

phases = [ "installPhase" ];
dontUnpack = true;
installPhase = ''
runHook preInstall
export COURSIER_CACHE=$(pwd)
export COURSIER_JVM_CACHE=$(pwd)
mkdir channel
ln -s ${bloop-coursier-channel} channel/bloop.json
${coursier}/bin/cs install --install-dir $out --install-platform ${platform} --default-channels=false --channel channel --only-prebuilt=true bloop
${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
# Remove binary part of the coursier launcher script to make derivation output hash stable
sed -i '5,$ d' $out/bloop
'';
runHook postInstall
'';

outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = if stdenv.isLinux && stdenv.isx86_64 then "1hxyzf430g95l6qz1qlq8wvizvy6j3a7a9crb3lcxd67cpbg3x7i"
else if stdenv.isDarwin && stdenv.isx86_64 then "0x5yqf3i8y6s5h27yr0jkpvj6ch25ckx2802dmaxlgq6gz0fx6w2"
else throw "unsupported platform";
outputHash = if stdenv.isLinux && stdenv.isx86_64 then "0c02n779z4l7blzla5820bzfhblbp5nlizx9f8wns4miwnph357f"
else if stdenv.isDarwin && stdenv.isx86_64 then "1gy5k9ii86rxyv2v9if4n1clvmb1hi4ym32mp6miwgcjla10sv30"
else throw "unsupported platform";
};

dontUnpack = true;
nativeBuildInputs = [ autoPatchelfHook installShellFiles ];
nativeBuildInputs = [ autoPatchelfHook installShellFiles makeWrapper ];
buildInputs = [ stdenv.cc.cc.lib zlib ];
propagatedBuildInputs = [ jre ];

installPhase = ''
runHook preInstall
export COURSIER_CACHE=$(pwd)
export COURSIER_JVM_CACHE=$(pwd)
mkdir -p $out/bin
cp ${bloop-coursier}/bloop $out/bloop
cp ${bloop-coursier}/.bloop.aux $out/.bloop.aux
ln -s $out/bloop $out/bin/bloop
install -D -m 0755 ${bloop-coursier} $out/.bloop-wrapped
# patch the bloop launcher so that it works when symlinked
sed "s|\$(dirname \"\$0\")|$out|" -i $out/bloop
makeWrapper $out/.bloop-wrapped $out/bin/bloop \
--set CS_NATIVE_LAUNCHER true \
--set IS_CS_INSTALLED_LAUNCHER true
#Install completions
installShellCompletion --name bloop --bash ${bloop-bash}
installShellCompletion --name _bloop --zsh ${bloop-zsh}
installShellCompletion --name bloop.fish --fish ${bloop-fish}
runHook postInstall
'';

meta = with lib; {
Expand Down

0 comments on commit 305b7de

Please sign in to comment.