2021-01-23 12:26:19 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper, jre, writeScript, common-updater-scripts
|
2023-10-17 11:01:54 +00:00
|
|
|
, coreutils, git, gnused, nix, zlib }:
|
2017-03-20 03:58:24 +00:00
|
|
|
|
2023-10-17 11:01:54 +00:00
|
|
|
let
|
|
|
|
libPath = lib.makeLibraryPath [
|
|
|
|
zlib # libz.so.1
|
|
|
|
];
|
|
|
|
in
|
2023-03-13 16:16:07 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "coursier";
|
2024-05-06 14:43:58 +00:00
|
|
|
version = "2.1.10";
|
2017-03-20 03:58:24 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-03-13 16:16:07 +00:00
|
|
|
url = "https://github.com/coursier/coursier/releases/download/v${version}/coursier";
|
2024-05-06 14:43:58 +00:00
|
|
|
hash = "sha256-fiZwmDDuaafBbYQdOxPpTrleMLOSakCteizpKwcGStk=";
|
2017-03-20 03:58:24 +00:00
|
|
|
};
|
|
|
|
|
2023-10-17 11:01:54 +00:00
|
|
|
dontUnpack = true;
|
|
|
|
|
2017-03-20 16:04:40 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2017-03-20 03:58:24 +00:00
|
|
|
|
2023-10-17 11:01:54 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2021-10-19 20:40:38 +00:00
|
|
|
install -Dm555 $src $out/bin/cs
|
|
|
|
patchShebangs $out/bin/cs
|
2023-10-17 11:01:54 +00:00
|
|
|
wrapProgram $out/bin/cs \
|
|
|
|
--prefix PATH ":" ${lib.makeBinPath [ jre ]} \
|
|
|
|
--prefix LD_LIBRARY_PATH ":" ${libPath}
|
|
|
|
|
|
|
|
runHook postInstall
|
2020-11-06 01:54:12 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -o errexit
|
2023-03-13 16:16:07 +00:00
|
|
|
PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused nix ]}
|
2020-11-06 01:54:12 +00:00
|
|
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
|
2023-03-13 16:16:07 +00:00
|
|
|
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/coursier/coursier.git 'v*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
|
2020-11-06 01:54:12 +00:00
|
|
|
if [ "$oldVersion" != "$latestTag" ]; then
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
default_nix="$nixpkgs/pkgs/development/tools/coursier/default.nix"
|
|
|
|
update-source-version ${pname} "$latestTag" --version-key=version --print-changes
|
|
|
|
else
|
|
|
|
echo "${pname} is already up-to-date"
|
|
|
|
fi
|
2017-03-20 03:58:24 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://get-coursier.io/";
|
2023-03-13 16:16:07 +00:00
|
|
|
description = "Scala library to fetch dependencies from Maven / Ivy repositories";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "cs";
|
2017-04-08 19:03:33 +00:00
|
|
|
license = licenses.asl20;
|
2017-03-20 16:04:40 +00:00
|
|
|
maintainers = with maintainers; [ adelbertc nequissimus ];
|
2023-10-17 11:01:54 +00:00
|
|
|
platforms = platforms.all;
|
2017-03-20 03:58:24 +00:00
|
|
|
};
|
|
|
|
}
|