Unverified Commit 1a6b0ac8 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

jetbrains-toolbox: 2.6.2.41321 -> 2.6.3.43718 (#417617)

parents 9f856ea6 151b48c1
Loading
Loading
Loading
Loading
+73 −68
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  appimageTools,
  stdenvNoCC,
  buildFHSEnv,
  fetchzip,
  fetchurl,
  makeWrapper,
  icu,
  libappindicator-gtk3,
  appimageTools,
  undmg,
}:

let
  pname = "jetbrains-toolbox";
  version = "2.6.2.41321";
  version = "2.6.3.43718";

  updateScript = ./update.sh;

@@ -20,7 +18,8 @@ let
    description = "Jetbrains Toolbox";
    homepage = "https://jetbrains.com/";
    license = lib.licenses.unfree;
    maintainers = with lib.maintainers; [ AnatolyPopov ];
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    maintainers = with lib.maintainers; [ ners ];
    platforms = [
      "aarch64-linux"
      "aarch64-darwin"
@@ -31,70 +30,77 @@ let
  };

  selectSystem =
    attrs:
    attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
    let
      inherit (stdenvNoCC.hostPlatform) system;
    in
    attrs: attrs.${system} or (throw "Unsupported system: ${system}");

  linux = appimageTools.wrapAppImage rec {
    inherit pname version meta;
  selectKernel =
    let
      inherit (stdenvNoCC.hostPlatform.parsed) kernel;
    in
    attrs: attrs.${kernel.name} or (throw "Unsupported kernel: ${kernel.name}");

    source =
  selectCpu =
    let
        arch = selectSystem {
          x86_64-linux = "";
          aarch64-linux = "-arm64";
        };
      inherit (stdenvNoCC.hostPlatform.parsed) cpu;
    in
      fetchzip {
        url = "https://download.jetbrains.com/toolbox/jetbrains-toolbox-${version}${arch}.tar.gz";
    attrs: attrs.${cpu.name} or (throw "Unsupported CPU: ${cpu.name}");

  sourceForVersion =
    version:
    let
      archSuffix = selectCpu {
        x86_64 = "";
        aarch64 = "-arm64";
      };
      hash = selectSystem {
          x86_64-linux = "sha256-nIvlO313GZhIpgyCUhp2FUzllD3tk0oRrxFzxtHSIQA=";
          aarch64-linux = "sha256-iggrnpjqLEqiteXnmA+eynTB7cs9YeOnNW4DWGP6mk0=";
        x86_64-linux = "sha256-qsj2Jsf4P03LeekaAcUQLVloKpY1pjnT0ffdo0LSD3M=";
        aarch64-linux = "sha256-QkavbPl1EnucbHWwqUcResuOFybMZLGlhZzv+YGqzeY=";
        x86_64-darwin = "sha256-3CzUKAp+Y/sCnGgI7UkMun4XnNEUSIg9dWFile1MLk4=";
        aarch64-darwin = "sha256-A4smWImeHwgQa9oaRpt/WPRxG+DWCdQ7ZrjNNKwV06I=";
      };
    in
    selectKernel {
      linux = fetchzip {
        url = "https://download-cdn.jetbrains.com/toolbox/jetbrains-toolbox-${version}${archSuffix}.tar.gz";
        inherit hash;
      };

    src = appimageTools.extractType2 {
      inherit pname version;
      src = source + "/jetbrains-toolbox";
      darwin = fetchurl {
        url = "https://download-cdn.jetbrains.com/toolbox/jetbrains-toolbox-${version}${archSuffix}.dmg";
        inherit hash;
      };

    nativeBuildInputs = [ makeWrapper ];

    extraInstallCommands = ''
      install -Dm644 ${src}/jetbrains-toolbox.desktop $out/share/applications/jetbrains-toolbox.desktop
      install -Dm644 ${src}/.DirIcon $out/share/icons/hicolor/scalable/apps/jetbrains-toolbox.svg
      wrapProgram $out/bin/jetbrains-toolbox \
        --prefix LD_LIBRARY_PATH : ${
          lib.makeLibraryPath [
    };
in
selectKernel {
  linux =
    let
      src = sourceForVersion version;
    in
    buildFHSEnv {
      inherit pname version meta;
      passthru = {
        inherit src updateScript;
      };
      multiPkgs =
        pkgs:
        with pkgs;
        [
          icu
          libappindicator-gtk3
        ]
        } \
        --append-flags "--update-failed"
    '';

    passthru = {
      src = source;
      inherit updateScript;
    };
        ++ appimageTools.defaultFhsEnvArgs.multiPkgs pkgs;
      runScript = "${src}/bin/jetbrains-toolbox --update-failed";
    };

  darwin = stdenv.mkDerivation (finalAttrs: {
    inherit pname version meta;
  darwin = stdenvNoCC.mkDerivation (finalAttrs: {
    inherit
      pname
      version
      meta
      ;

    src =
      let
        arch = selectSystem {
          x86_64-darwin = "";
          aarch64-darwin = "-arm64";
        };
      in
      fetchurl {
        url = "https://download.jetbrains.com/toolbox/jetbrains-toolbox-${finalAttrs.version}${arch}.dmg";
        hash = selectSystem {
          x86_64-darwin = "sha256-518Ew3yhj6wrTfPklNTC6La0EOb/XmrFcNmoeNbod8k=";
          aarch64-darwin = "sha256-Enyn4iJn8qLUdrvin44bGLv0dzl5VOL6KPi4AODhtPE=";
        };
      };
    src = sourceForVersion finalAttrs.version;

    nativeBuildInputs = [ undmg ];

@@ -114,5 +120,4 @@ let
      inherit updateScript;
    };
  });
in
if stdenv.hostPlatform.isDarwin then darwin else linux
}
+14 −22
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
set -eou pipefail

latestVersion=$(curl -Ls 'https://data.services.jetbrains.com/products?code=TBA&release.type=release' | jq -r '.[0].releases | flatten | .[0].build')
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; jetbrains-toolbox.version or (lib.getVersion jetbrains-toolbox)" | tr -d '"')
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; jetbrains-toolbox.version" | tr -d '"')

echo "latest  version: $latestVersion"
echo "current version: $currentVersion"
@@ -14,28 +14,20 @@ if [[ "$latestVersion" == "$currentVersion" ]]; then
    exit 0
fi

linux_systems=(
    "x86_64-linux:"
    "aarch64-linux:-arm64"
)
update-source-version jetbrains-toolbox $latestVersion

for entry in "${linux_systems[@]}"; do
    arch="${entry%%:*}"
    suffix="${entry#*:}"
    prefetch=$(nix-prefetch-url --unpack "https://download.jetbrains.com/toolbox/jetbrains-toolbox-$latestVersion$suffix.tar.gz")
    hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch)
    update-source-version jetbrains-toolbox $latestVersion $hash --system=$arch --ignore-same-version
done
systems=$(nix-instantiate --eval --json -E 'with import ./. {}; jetbrains-toolbox.meta.platforms' | jq -r '.[]')

darwin_systems=(
    "x86_64-darwin:"
    "aarch64-darwin:-arm64"
)

for entry in "${darwin_systems[@]}"; do
    arch="${entry%%:*}"
    suffix="${entry#*:}"
    prefetch=$(nix-prefetch-url "https://download.jetbrains.com/toolbox/jetbrains-toolbox-$latestVersion$suffix.dmg")
for system in $systems; do
    arch="${system%%:*}"
    suffix="${system#*:}"
    url=$(nix-instantiate --eval --json -E "with import ./. { system = \"$system\"; }; jetbrains-toolbox.src.url" | jq -r)
    if [[ $url == *.tar.gz ]]; then
      unpack="--unpack"
    else
      unpack=""
    fi
    prefetch=$(nix-prefetch-url $unpack "$url")
    hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch)
    update-source-version jetbrains-toolbox $latestVersion $hash --system=$arch --ignore-same-version
    update-source-version jetbrains-toolbox $latestVersion $hash --system=$system --ignore-same-version
done