619d6dcc77
GitOrigin-RevId: 870959c7fb3a42af1863bed9e1756086a74eb649
77 lines
2.3 KiB
Nix
77 lines
2.3 KiB
Nix
{ lib, stdenv, fetchFromGitHub, which, curl, makeWrapper, jdk, writeScript
|
|
, common-updater-scripts, cacert, git, nixfmt, nix, jq, coreutils, gnused }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "sbt-extras";
|
|
rev = "d77c348e3f2fdfbd90b51ce0e5894405bb08687c";
|
|
version = "2021-08-04";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "paulp";
|
|
repo = "sbt-extras";
|
|
inherit rev;
|
|
sha256 = "u0stt4w0iK4h+5PMkqjp9m8kqvrKvM3m7lBcV2yXPKU=";
|
|
};
|
|
|
|
dontBuild = true;
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
|
|
substituteInPlace bin/sbt --replace 'declare java_cmd="java"' 'declare java_cmd="${jdk}/bin/java"'
|
|
|
|
install bin/sbt $out/bin
|
|
|
|
wrapProgram $out/bin/sbt --prefix PATH : ${lib.makeBinPath [ which curl ]}
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
installCheckPhase = ''
|
|
$out/bin/sbt -h >/dev/null
|
|
'';
|
|
|
|
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
|
|
'';
|
|
|
|
meta = {
|
|
description =
|
|
"A more featureful runner for sbt, the simple/scala/standard build tool";
|
|
homepage = "https://github.com/paulp/sbt-extras";
|
|
license = lib.licenses.bsd3;
|
|
maintainers = with lib.maintainers; [ nequissimus puffnfresh ];
|
|
platforms = lib.platforms.unix;
|
|
};
|
|
}
|