at 24.11-pre 57 lines 1.9 kB view raw
1{ lib, stdenv, fetchurl, makeWrapper, jre, writeScript, common-updater-scripts 2, coreutils, git, gnused, nix, zlib }: 3 4let 5 libPath = lib.makeLibraryPath [ 6 zlib # libz.so.1 7 ]; 8in 9stdenv.mkDerivation rec { 10 pname = "coursier"; 11 version = "2.1.10"; 12 13 src = fetchurl { 14 url = "https://github.com/coursier/coursier/releases/download/v${version}/coursier"; 15 hash = "sha256-fiZwmDDuaafBbYQdOxPpTrleMLOSakCteizpKwcGStk="; 16 }; 17 18 dontUnpack = true; 19 20 nativeBuildInputs = [ makeWrapper ]; 21 22 installPhase = '' 23 runHook preInstall 24 25 install -Dm555 $src $out/bin/cs 26 patchShebangs $out/bin/cs 27 wrapProgram $out/bin/cs \ 28 --prefix PATH ":" ${lib.makeBinPath [ jre ]} \ 29 --prefix LD_LIBRARY_PATH ":" ${libPath} 30 31 runHook postInstall 32 ''; 33 34 passthru.updateScript = writeScript "update.sh" '' 35 #!${stdenv.shell} 36 set -o errexit 37 PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused nix ]} 38 oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')" 39 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')" 40 if [ "$oldVersion" != "$latestTag" ]; then 41 nixpkgs="$(git rev-parse --show-toplevel)" 42 default_nix="$nixpkgs/pkgs/development/tools/coursier/default.nix" 43 update-source-version ${pname} "$latestTag" --version-key=version --print-changes 44 else 45 echo "${pname} is already up-to-date" 46 fi 47 ''; 48 49 meta = with lib; { 50 homepage = "https://get-coursier.io/"; 51 description = "Scala library to fetch dependencies from Maven / Ivy repositories"; 52 mainProgram = "cs"; 53 license = licenses.asl20; 54 maintainers = with maintainers; [ adelbertc nequissimus ]; 55 platforms = platforms.all; 56 }; 57}