2021-02-25 16:40:42 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, which, curl, makeWrapper, jdk, writeScript
|
|
|
|
, common-updater-scripts, cacert, git, nixfmt, nix, jq, coreutils, gnused }:
|
2017-10-26 01:30:45 +01:00
|
|
|
|
2020-11-11 14:19:51 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sbt-extras";
|
2021-04-07 19:00:26 +01:00
|
|
|
rev = "a76f1f15e6ec39d886f8bf07d5bdfaf70cdc62d8";
|
|
|
|
version = "2021-04-06";
|
2017-10-26 01:30:45 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "paulp";
|
|
|
|
repo = "sbt-extras";
|
|
|
|
inherit rev;
|
2021-04-07 19:00:26 +01:00
|
|
|
sha256 = "0zmhn8nvzrbw047g5z4q2slp0wdg6pvfh2pqnpwcq1hscf7dvz8f";
|
2017-10-26 01:30:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2017-10-31 20:27:48 +00:00
|
|
|
|
2017-10-26 01:30:45 +01:00
|
|
|
installPhase = ''
|
2021-03-04 15:44:31 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2017-10-26 01:30:45 +01:00
|
|
|
mkdir -p $out/bin
|
2017-12-10 18:47:28 +00:00
|
|
|
|
|
|
|
substituteInPlace bin/sbt --replace 'declare java_cmd="java"' 'declare java_cmd="${jdk}/bin/java"'
|
|
|
|
|
2017-10-26 01:30:45 +01:00
|
|
|
install bin/sbt $out/bin
|
2017-10-31 20:27:48 +00:00
|
|
|
|
2021-02-02 15:31:19 +00:00
|
|
|
wrapProgram $out/bin/sbt --prefix PATH : ${lib.makeBinPath [ which curl ]}
|
2021-03-04 15:44:31 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2017-10-26 01:30:45 +01:00
|
|
|
'';
|
|
|
|
|
2021-02-21 23:34:07 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/sbt -h >/dev/null
|
|
|
|
'';
|
2020-11-11 14:19:51 +00:00
|
|
|
|
2021-02-21 23:34:07 +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-11 14:19:51 +00:00
|
|
|
|
2017-10-26 01:30:45 +01:00
|
|
|
meta = {
|
2020-11-11 14:19:51 +00:00
|
|
|
description =
|
|
|
|
"A more featureful runner for sbt, the simple/scala/standard build tool";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/paulp/sbt-extras";
|
2021-01-23 12:26:19 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ nequissimus puffnfresh ];
|
|
|
|
platforms = lib.platforms.unix;
|
2017-10-26 01:30:45 +01:00
|
|
|
};
|
|
|
|
}
|