Unverified Commit e4e516d1 authored by Eduardo Maia's avatar Eduardo Maia
Browse files

iterm2: `3.5.14` -> `3.6.6`, update script and new maintainer

parent 061bfb90
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -15,13 +15,13 @@

stdenvNoCC.mkDerivation rec {
  pname = "iterm2";
  version = "3.5.14";
  version = "3.6.6";

  src = fetchzip {
    url = "https://iterm2.com/downloads/stable/iTerm2-${
      lib.replaceStrings [ "." ] [ "_" ] version
    }.zip";
    hash = "sha256-cF7gg4kT0z/7Qu7d6AyXpnvrSQ937JbFUgpXw5F4AWE=";
    hash = "sha256-n3VoRxMOBQK/8mbVbORSBz73tsuKAUMG7dFZIbaqdHU=";
  };

  dontFixup = true;
@@ -40,6 +40,8 @@ stdenvNoCC.mkDerivation rec {
    runHook postInstall
  '';

  passthru.updateScript = ./update.sh;

  meta = with lib; {
    description = "Replacement for Terminal and the successor to iTerm";
    homepage = "https://www.iterm2.com/";
@@ -48,6 +50,7 @@ stdenvNoCC.mkDerivation rec {
    maintainers = with maintainers; [
      steinybot
      tricktron
      emaiax
    ];
    platforms = [
      "x86_64-darwin"
+36 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl coreutils common-updater-scripts
set -eu -o pipefail

currentVersion=$(nix-instantiate --eval -E "with import ./. {}; iterm2.version or (lib.getVersion iterm2)" | tr -d '"')

downloadUrl=$(
  curl -sL "https://iterm2.com/downloads.html" |
  grep -o -E 'href="[^"]*iTerm2[^"]*\.zip"' |
  sed 's/href="//;s/"//' |
  head -1
)

if [[ -z "$downloadUrl" ]]; then
  echo >&2 "Failed to extract download url from iTerm2 downloads page"
  exit 1
fi

version=$(echo "$downloadUrl" | sed -E '
  s/.*iTerm2-?//    # Remove iTerm2 link prefix from download url
  s/[vV]//          # Remove version "v" prefix
  s/\.zip$//        # Remove .zip extension
  s/_/./g           # Convert underscores to dots
')

# iterm2 is already up to date
if [[ "$version" == "$currentVersion" ]]; then
  exit 0
fi

# Update package version
#
source=$(nix-prefetch-url "$downloadUrl" --unpack --name "iterm2-$version")
hash=$(nix-hash --to-sri --type sha256 "$source")

update-source-version iterm2 $version $hash --ignore-same-version --ignore-same-hash