sbt: Add update script
This commit is contained in:
parent
f290e0ec6b
commit
d92254fbeb
@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl, jre, autoPatchelfHook, zlib }:
|
||||
{ stdenv, fetchurl, jre, autoPatchelfHook, zlib, writeScript, common-updater-scripts, git, nixfmt, nix, coreutils, gnused }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "sbt";
|
||||
@ -34,4 +34,22 @@ stdenv.mkDerivation rec {
|
||||
maintainers = with maintainers; [ nequissimus ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
|
||||
passthru.updateScript = writeScript "update.sh" ''
|
||||
#!${stdenv.shell}
|
||||
set -o errexit
|
||||
PATH=${stdenv.lib.makeBinPath [ common-updater-scripts git nixfmt nix coreutils gnused ]}
|
||||
|
||||
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
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user