3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/build-managers/bloop/default.nix

101 lines
3.2 KiB
Nix
Raw Normal View History

{ stdenv
, fetchurl
, coursier
, autoPatchelfHook
2020-07-11 10:37:59 +01:00
, installShellFiles
2021-11-04 23:27:50 +00:00
, makeWrapper
2020-07-11 10:37:59 +01:00
, jre
, lib
, zlib
}:
2018-06-03 20:48:05 +01:00
stdenv.mkDerivation rec {
pname = "bloop";
2022-01-12 17:25:10 +00:00
version = "1.4.12";
bloop-coursier-channel = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bloop-coursier.json";
2022-01-12 17:25:10 +00:00
sha256 = "bf3uHuGfmJukf0Qeudv8ZXz/9Uql/qsmvPS0XBb7oTQ=";
};
bloop-bash = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bash-completions";
2021-11-04 23:27:50 +00:00
sha256 = "2mt+zUEJvQ/5ixxFLZ3Z0m7uDSj/YE9sg/uNMjamvdE=";
};
bloop-fish = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/fish-completions";
2022-01-12 17:25:10 +00:00
sha256 = "eFESR6iPHRDViGv+Fk3sCvPgVAhk2L1gCG4LnfXO/v4=";
2018-06-03 20:48:05 +01:00
};
bloop-zsh = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/zsh-completions";
2021-11-04 23:27:50 +00:00
sha256 = "WNMsPwBfd5EjeRbRtc06lCEVI2FVoLfrqL82OR0G7/c=";
};
2020-07-11 10:37:59 +01:00
bloop-coursier = stdenv.mkDerivation rec {
name = "${pname}-coursier-${version}";
2020-07-11 10:37:59 +01:00
platform = if stdenv.isLinux && stdenv.isx86_64 then "x86_64-pc-linux"
2021-11-04 23:27:50 +00:00
else if stdenv.isDarwin && stdenv.isx86_64 then "x86_64-apple-darwin"
else throw "unsupported platform";
2020-07-11 10:37:59 +01:00
2021-11-04 23:27:50 +00:00
dontUnpack = true;
installPhase = ''
2021-11-04 23:27:50 +00:00
runHook preInstall
export COURSIER_CACHE=$(pwd)
export COURSIER_JVM_CACHE=$(pwd)
mkdir channel
ln -s ${bloop-coursier-channel} channel/bloop.json
2021-11-04 23:27:50 +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-06-29 12:18:25 +01:00
2021-11-04 23:27:50 +00:00
runHook postInstall
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
2022-01-12 17:25:10 +00:00
outputHash = if stdenv.isLinux && stdenv.isx86_64 then "jqcecAM51qEDmTim2VBNm8IO8wQmwU19R57Zk4pxwSA="
else if stdenv.isDarwin && stdenv.isx86_64 then "15m2rahf9kihw29hp6bwd9xqav6dcr17w5c2rsw0ijpchr2av72q"
2021-11-04 23:27:50 +00:00
else throw "unsupported platform";
2018-06-03 20:48:05 +01:00
};
2020-07-11 10:37:59 +01:00
dontUnpack = true;
2021-11-04 23:27:50 +00:00
nativeBuildInputs = [ autoPatchelfHook installShellFiles makeWrapper ];
2020-07-11 10:37:59 +01:00
buildInputs = [ stdenv.cc.cc.lib zlib ];
propagatedBuildInputs = [ jre ];
2018-06-03 20:48:05 +01:00
installPhase = ''
2021-11-04 23:27:50 +00:00
runHook preInstall
export COURSIER_CACHE=$(pwd)
export COURSIER_JVM_CACHE=$(pwd)
2021-11-04 23:27:50 +00:00
install -D -m 0755 ${bloop-coursier} $out/.bloop-wrapped
2018-06-03 20:48:05 +01:00
2021-11-04 23:27:50 +00:00
makeWrapper $out/.bloop-wrapped $out/bin/bloop \
--set CS_NATIVE_LAUNCHER true \
--set IS_CS_INSTALLED_LAUNCHER true
2018-06-03 20:48:05 +01:00
#Install completions
2020-07-11 10:37:59 +01:00
installShellCompletion --name bloop --bash ${bloop-bash}
installShellCompletion --name _bloop --zsh ${bloop-zsh}
installShellCompletion --name bloop.fish --fish ${bloop-fish}
2021-11-04 23:27:50 +00:00
runHook postInstall
2018-06-03 20:48:05 +01:00
'';
meta = with lib; {
homepage = "https://scalacenter.github.io/bloop/";
2018-06-03 20:48:05 +01:00
license = licenses.asl20;
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-07-11 10:37:59 +01:00
platforms = [ "x86_64-linux" "x86_64-darwin" ];
2021-11-04 23:28:01 +00:00
maintainers = with maintainers; [ kubukoz tomahna ];
2018-06-03 20:48:05 +01:00
};
}