2021-01-23 12:26:19 +00:00
|
|
|
{ lib, stdenv, fetchurl, jre, autoPatchelfHook, zlib, writeScript
|
2020-11-03 16:51:36 +00:00
|
|
|
, common-updater-scripts, git, nixfmt, nix, coreutils, gnused, nixosTests }:
|
2010-05-08 22:51:47 +01:00
|
|
|
|
2013-11-05 13:19:11 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "sbt";
|
2021-02-01 15:12:23 +00:00
|
|
|
version = "1.4.7";
|
2013-05-14 23:41:22 +01:00
|
|
|
|
2013-11-05 13:19:11 +00:00
|
|
|
src = fetchurl {
|
2020-10-08 15:50:33 +01:00
|
|
|
url =
|
|
|
|
"https://github.com/sbt/sbt/releases/download/v${version}/sbt-${version}.tgz";
|
2021-02-01 15:12:23 +00:00
|
|
|
sha256 = "sha256-wqdZ/kCjwhoWtaiNAM1m869vByHk6mG2OULfuDotVP0=";
|
2013-05-14 23:41:22 +01:00
|
|
|
};
|
2010-05-08 22:51:47 +01:00
|
|
|
|
2015-09-25 15:54:35 +01:00
|
|
|
patchPhase = ''
|
|
|
|
echo -java-home ${jre.home} >>conf/sbtopts
|
|
|
|
'';
|
2013-05-14 23:41:22 +01:00
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
2020-10-05 11:03:53 +01:00
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ zlib ];
|
2020-10-05 11:03:53 +01:00
|
|
|
|
2013-05-14 23:41:22 +01:00
|
|
|
installPhase = ''
|
2015-09-25 15:54:35 +01:00
|
|
|
mkdir -p $out/share/sbt $out/bin
|
|
|
|
cp -ra . $out/share/sbt
|
2020-10-05 11:03:53 +01:00
|
|
|
ln -sT ../share/sbt/bin/sbt $out/bin/sbt
|
2020-10-08 15:50:33 +01:00
|
|
|
ln -sT ../share/sbt/bin/sbtn-x86_64-${
|
|
|
|
if (stdenv.isDarwin) then "apple-darwin" else "pc-linux"
|
|
|
|
} $out/bin/sbtn
|
2013-05-14 23:41:22 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 19:55:05 +01:00
|
|
|
homepage = "https://www.scala-sbt.org/";
|
2016-07-21 11:29:14 +01:00
|
|
|
license = licenses.bsd3;
|
2013-11-05 13:19:11 +00:00
|
|
|
description = "A build tool for Scala, Java and more";
|
2019-08-20 14:24:01 +01:00
|
|
|
maintainers = with maintainers; [ nequissimus ];
|
2016-07-21 11:29:14 +01:00
|
|
|
platforms = platforms.unix;
|
2014-06-05 11:36:39 +01:00
|
|
|
};
|
2020-11-03 16:16:05 +00:00
|
|
|
|
2020-11-03 16:51:36 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) sbt; };
|
2020-11-03 16:16:05 +00:00
|
|
|
|
2020-11-03 16:51:36 +00:00
|
|
|
updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -o errexit
|
|
|
|
PATH=${
|
2021-01-23 12:26:19 +00:00
|
|
|
lib.makeBinPath [
|
2020-11-03 16:51:36 +00:00
|
|
|
common-updater-scripts
|
|
|
|
git
|
|
|
|
nixfmt
|
|
|
|
nix
|
|
|
|
coreutils
|
|
|
|
gnused
|
|
|
|
]
|
|
|
|
}
|
2020-11-03 16:16:05 +00:00
|
|
|
|
2020-11-03 16:51:36 +00:00
|
|
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion sbt" | tr -d '"')"
|
|
|
|
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:sbt/sbt.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
|
|
|
|
|
|
|
|
if [ ! "$oldVersion" = "$latestTag" ]; then
|
|
|
|
update-source-version sbt "$latestTag" --version-key=version --print-changes
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix"
|
|
|
|
nixfmt "$default_nix"
|
|
|
|
else
|
|
|
|
echo "sbt is already up-to-date"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2013-05-14 23:41:22 +01:00
|
|
|
}
|