Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 831ffe26a759
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 21d863f7e087
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Nov 6, 2020

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    NeQuissimus Tim Steinbach
    Copy the full SHA
    8846bd9 View commit details
  2. Merge pull request #102982 from NeQuissimus/coursier_update

    coursier: Add update script
    NeQuissimus authored Nov 6, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    21d863f View commit details
Showing with 47 additions and 10 deletions.
  1. +47 −10 pkgs/development/tools/coursier/default.nix
57 changes: 47 additions & 10 deletions pkgs/development/tools/coursier/default.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{ stdenv, fetchurl, makeWrapper, jre }:
{ stdenv, fetchurl, makeWrapper, jre, writeScript, common-updater-scripts
, coreutils, git, gnused, nix, nixfmt }:

let
zshCompletion = version: fetchurl {
url = "https://raw.githubusercontent.com/coursier/coursier/v${version}/modules/cli/src/main/resources/completions/zsh";
version = "2.0.6";

zshCompletion = fetchurl {
url =
"https://raw.githubusercontent.com/coursier/coursier/v${version}/modules/cli/src/main/resources/completions/zsh";
sha256 = "0afxzrk9w1qinfsz55jjrxydw0fcv6p722g1q955dl7f6xbab1jh";
};
in
stdenv.mkDerivation rec {

repo = "git@github.com:coursier/coursier.git";
in stdenv.mkDerivation rec {
inherit version;

pname = "coursier";
version = "2.0.6";

src = fetchurl {
url = "https://github.com/coursier/coursier/releases/download/v${version}/coursier";
sha256 = "0zg07bi44a5p0zfc77i1vmjz9rwzxzf6p0xsybsv3n1saq884wij";
url =
"https://github.com/coursier/coursier/releases/download/v${version}/coursier";
sha256 = "MnKCEFY62LH18rqDa9zvn+f0Zd0hnsPcB7coQuI64H0=";
};

nativeBuildInputs = [ makeWrapper ];
@@ -23,12 +30,42 @@ stdenv.mkDerivation rec {
wrapProgram $out/bin/coursier --prefix PATH ":" ${jre}/bin
# copy zsh completion
install -Dm755 ${zshCompletion version} $out/share/zsh/site-functions/_coursier
install -Dm755 ${zshCompletion} $out/share/zsh/site-functions/_coursier
'';

passthru.updateScript = writeScript "update.sh" ''
#!${stdenv.shell}
set -o errexit
PATH=${
stdenv.lib.makeBinPath [
common-updater-scripts
coreutils
git
gnused
nix
nixfmt
]
}
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags ${repo} 'v*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
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
url="${builtins.head zshCompletion.urls}"
completion_url=$(echo $url | sed "s|$oldVersion|$latestTag|g")
completion_sha256="$(nix-prefetch-url --type sha256 $completion_url)"
sed -i "s|${zshCompletion.outputHash}|$completion_sha256|g" "$default_nix"
nixfmt "$default_nix"
else
echo "${pname} is already up-to-date"
fi
'';

meta = with stdenv.lib; {
homepage = "https://get-coursier.io/";
description = "A Scala library to fetch dependencies from Maven / Ivy repositories";
description =
"A Scala library to fetch dependencies from Maven / Ivy repositories";
license = licenses.asl20;
maintainers = with maintainers; [ adelbertc nequissimus ];
};