2020-11-12 09:05:59 +00:00
|
|
|
{ stdenv, fetchFromGitHub, which, curl, makeWrapper, jdk, writeScript
|
|
|
|
, common-updater-scripts, cacert, git, nixfmt, nix, jq, coreutils, gnused
|
|
|
|
, nixosTests }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sbt-extras";
|
2020-12-29 15:07:52 +00:00
|
|
|
rev = "4db8d5c27413f69297adfffac57485d88d73c60e";
|
|
|
|
version = "2020-12-26";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "paulp";
|
|
|
|
repo = "sbt-extras";
|
|
|
|
inherit rev;
|
2020-12-29 15:07:52 +00:00
|
|
|
sha256 = "B8abzdohkw3aPhbENJ2vxZFLWhIpf0HF/uv+WJbVRYg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
substituteInPlace bin/sbt --replace 'declare java_cmd="java"' 'declare java_cmd="${jdk}/bin/java"'
|
|
|
|
|
|
|
|
install bin/sbt $out/bin
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
wrapProgram $out/bin/sbt --prefix PATH : ${
|
|
|
|
stdenv.lib.makeBinPath [ which curl ]
|
|
|
|
}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) sbt-extras; };
|
|
|
|
|
|
|
|
updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -xo errexit
|
|
|
|
PATH=${
|
|
|
|
stdenv.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-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";
|
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2020-11-12 09:05:59 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ nequissimus puffnfresh ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
|
|
|
};
|
|
|
|
}
|