commit
27e030a1cc
@ -9,6 +9,20 @@ let
|
|||||||
in {
|
in {
|
||||||
|
|
||||||
options.services.bloop = {
|
options.services.bloop = {
|
||||||
|
extraOptions = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = [
|
||||||
|
"-J-Xmx2G"
|
||||||
|
"-J-XX:MaxInlineLevel=20"
|
||||||
|
"-J-XX:+UseParallelGC"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
Specifies additional command line argument to pass to bloop
|
||||||
|
java process.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
install = mkOption {
|
install = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
@ -25,9 +39,12 @@ in {
|
|||||||
systemd.user.services.bloop = {
|
systemd.user.services.bloop = {
|
||||||
description = "Bloop Scala build server";
|
description = "Bloop Scala build server";
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
PATH = mkForce "${makeBinPath [ config.programs.java.package ]}";
|
||||||
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = ''${pkgs.bloop}/bin/blp-server'';
|
ExecStart = ''${pkgs.bloop}/bin/bloop server'';
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,56 +1,71 @@
|
|||||||
{ stdenv, lib, fetchurl, coursier, jdk, jre, python, makeWrapper }:
|
{ stdenv, lib, fetchurl, coursier, python, makeWrapper }:
|
||||||
|
|
||||||
let
|
let
|
||||||
baseName = "bloop";
|
baseName = "bloop";
|
||||||
version = "1.2.5";
|
version = "1.3.2";
|
||||||
deps = stdenv.mkDerivation {
|
nailgunCommit = "9327a60a"; # Fetched from https://github.com/scalacenter/bloop/releases/download/v${version}/install.py
|
||||||
name = "${baseName}-deps-${version}";
|
|
||||||
|
client = stdenv.mkDerivation {
|
||||||
|
name = "${baseName}-client-${version}";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://raw.githubusercontent.com/scalacenter/nailgun/${nailgunCommit}/pynailgun/ng.py";
|
||||||
|
sha256 = "0z4as5ibmzkd145wsch9caiy4037bgg780gcf7pyns0cv9n955b4";
|
||||||
|
};
|
||||||
|
|
||||||
|
phases = [ "installPhase" ];
|
||||||
|
|
||||||
|
installPhase = ''cp $src $out'';
|
||||||
|
};
|
||||||
|
|
||||||
|
server = stdenv.mkDerivation {
|
||||||
|
name = "${baseName}-server-${version}";
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
|
||||||
export COURSIER_CACHE=$(pwd)
|
export COURSIER_CACHE=$(pwd)
|
||||||
${coursier}/bin/coursier fetch ch.epfl.scala:bloop-frontend_2.12:${version} \
|
${coursier}/bin/coursier bootstrap ch.epfl.scala:bloop-frontend_2.12:${version} \
|
||||||
-r "bintray:scalameta/maven" \
|
-r "bintray:scalameta/maven" \
|
||||||
-r "bintray:scalacenter/releases" \
|
-r "bintray:scalacenter/releases" \
|
||||||
-r "https://oss.sonatype.org/content/repositories/staging" > deps
|
-r "https://oss.sonatype.org/content/repositories/staging" \
|
||||||
mkdir -p $out/share/java
|
--deterministic \
|
||||||
cp $(< deps) $out/share/java/
|
-f --main bloop.Server -o $out/bin/blp-server
|
||||||
'';
|
'';
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHashAlgo = "sha256";
|
outputHashAlgo = "sha256";
|
||||||
outputHash = "19373fyb0g7irrdzb1vsjmyv5xj84qwbcfb6lm076px7wfyn0w1c";
|
outputHash = "0k9zc9q793fkfwcssbkmzb0nxmgb99rwi0pjkqhvf719vmgvhc2a";
|
||||||
|
};
|
||||||
|
|
||||||
|
zsh = stdenv.mkDerivation {
|
||||||
|
name = "${baseName}-zshcompletion-${version}";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://raw.githubusercontent.com/scalacenter/bloop/v${version}/etc/zsh/_bloop";
|
||||||
|
sha256 = "09qq5888vaqlqan2jbs2qajz2c3ff13zj8r0x2pcxsqmvlqr02hp";
|
||||||
|
};
|
||||||
|
|
||||||
|
phases = [ "installPhase" ];
|
||||||
|
|
||||||
|
installPhase = ''cp $src $out'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "${baseName}-${version}";
|
name = "${baseName}-${version}";
|
||||||
|
|
||||||
# Fetched from https://github.com/scalacenter/bloop/releases/download/v${version}/install.py
|
buildInputs = [ makeWrapper ];
|
||||||
nailgunCommit = "0c325237";
|
|
||||||
|
|
||||||
buildInputs = [ jdk makeWrapper deps ];
|
|
||||||
|
|
||||||
phases = [ "installPhase" ];
|
phases = [ "installPhase" ];
|
||||||
|
|
||||||
client = fetchurl {
|
|
||||||
url = "https://raw.githubusercontent.com/scalacenter/nailgun/${nailgunCommit}/pynailgun/ng.py";
|
|
||||||
sha256 = "0qjw4nsyb4cxg96jj1yv5c0ivcxvmscxxqfzll5w9p1pjb30bq0n";
|
|
||||||
};
|
|
||||||
|
|
||||||
zshCompletion = fetchurl {
|
|
||||||
url = "https://raw.githubusercontent.com/scalacenter/bloop/v${version}/etc/zsh/_bloop";
|
|
||||||
sha256 = "1id6f1fgy2rk0q5aad6ffivhbxa94fallzsc04l9n0y1s2xdhqpm";
|
|
||||||
};
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
mkdir -p $out/share/zsh/site-functions
|
mkdir -p $out/share/zsh/site-functions
|
||||||
|
|
||||||
cp ${client} $out/bin/blp-client
|
ln -s ${server}/bin/blp-server $out/blp-server
|
||||||
cp ${zshCompletion} $out/share/zsh/site-functions/_bloop
|
ln -s ${zsh} $out/share/zsh/site-functions/_bloop
|
||||||
chmod +x $out/bin/blp-client
|
|
||||||
|
|
||||||
makeWrapper ${jre}/bin/java $out/bin/blp-server \
|
cp ${client} $out/bloop
|
||||||
--prefix PATH : ${lib.makeBinPath [ jdk ]} \
|
chmod +x $out/bloop
|
||||||
--add-flags "-cp $CLASSPATH bloop.Server"
|
makeWrapper $out/bloop $out/bin/bloop \
|
||||||
makeWrapper $out/bin/blp-client $out/bin/bloop \
|
|
||||||
--prefix PATH : ${lib.makeBinPath [ python ]}
|
--prefix PATH : ${lib.makeBinPath [ python ]}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user