2021-03-09 03:18:52 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, which, curl, makeWrapper, jdk, writeScript
|
|
|
|
, common-updater-scripts, cacert, git, nixfmt, nix, jq, coreutils, gnused }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sbt-extras";
|
2022-02-20 05:27:41 +00:00
|
|
|
rev = "8ccccd8a1d7efa097b7f30e0ec76e39b3aa0f3df";
|
|
|
|
version = "2021-11-08";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "paulp";
|
|
|
|
repo = "sbt-extras";
|
|
|
|
inherit rev;
|
2022-02-20 05:27:41 +00:00
|
|
|
sha256 = "376yaucqzoe36VKaJmCz+5vQHc+KNQG4iamAdOb/YQU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-03-09 03:18:52 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
substituteInPlace bin/sbt --replace 'declare java_cmd="java"' 'declare java_cmd="${jdk}/bin/java"'
|
|
|
|
|
|
|
|
install bin/sbt $out/bin
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
wrapProgram $out/bin/sbt --prefix PATH : ${lib.makeBinPath [ which curl ]}
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-22 21:28:39 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/sbt -h >/dev/null
|
|
|
|
'';
|
2020-11-12 09:05:59 +00:00
|
|
|
|
2021-02-22 21:28:39 +00:00
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -xo errexit
|
|
|
|
PATH=${
|
|
|
|
lib.makeBinPath [
|
|
|
|
common-updater-scripts
|
|
|
|
curl
|
|
|
|
cacert
|
|
|
|
git
|
|
|
|
nixfmt
|
|
|
|
nix
|
|
|
|
jq
|
|
|
|
coreutils
|
|
|
|
gnused
|
|
|
|
]
|
|
|
|
}
|
|
|
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
|
|
|
|
latestSha="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')"
|
|
|
|
if [ ! "null" = "$latestSha" ]; then
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt-extras/default.nix"
|
|
|
|
latestDate="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits/$latestSha | jq '.commit.committer.date' | sed 's|"\(.*\)T.*|\1|g')"
|
|
|
|
update-source-version ${pname} "$latestSha" --version-key=rev
|
|
|
|
update-source-version ${pname} "$latestDate" --ignore-same-hash
|
|
|
|
nixfmt "$default_nix"
|
|
|
|
else
|
|
|
|
echo "${pname} is already up-to-date"
|
|
|
|
fi
|
|
|
|
'';
|
2020-11-12 09:05:59 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2020-11-12 09:05:59 +00:00
|
|
|
description =
|
|
|
|
"A more featureful runner for sbt, the simple/scala/standard build tool";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/paulp/sbt-extras";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ nequissimus puffnfresh ];
|
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|