Loading pkgs/by-name/je/jetbrains-toolbox/package.nix +90 −65 Original line number Diff line number Diff line { stdenv, lib, stdenv, appimageTools, fetchzip, copyDesktopItems, fetchurl, makeWrapper, runCommand, appimageTools, icu, genericUpdater, writeShellScript, jq, undmg, }: let pname = "jetbrains-toolbox"; version = "2.5.4.38621"; src = fetchzip { url = "https://download.jetbrains.com/toolbox/jetbrains-toolbox-${version}.tar.gz"; hash = "sha256-FQTw6LPLJV+lV546rFOi/503PuErJs4T5q9MNWwGYEs="; stripRoot = false; passthru.updateScript = ./update.sh; meta = { description = "Jetbrains Toolbox"; homepage = "https://jetbrains.com/"; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ AnatolyPopov ]; platforms = [ "aarch64-linux" "aarch64-darwin" "x86_64-linux" "x86_64-darwin" ]; mainProgram = "jetbrains-toolbox"; }; appimageContents = runCommand "${pname}-extracted" { nativeBuildInputs = [ appimageTools.appimage-exec ]; } '' appimage-exec.sh -x $out ${src}/jetbrains-toolbox-${version}/jetbrains-toolbox selectSystem = attrs: attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); # JetBrains ship a broken desktop file. Despite registering a custom # scheme handler for jetbrains:// URLs, they never mark the command as # being suitable for passing URLs to. Ergo, the handler never receives # its payload. This causes various things to break, including login. # Reported upstream at: https://youtrack.jetbrains.com/issue/TBX-11478/ sed -Ei '/^Exec=/s/( %U)?$/ %U/' $out/jetbrains-toolbox.desktop ''; linux = appimageTools.wrapAppImage rec { inherit pname version passthru meta ; appimage = appimageTools.wrapAppImage { src = appimageTools.extractType2 { inherit pname version; src = appimageContents; src = let arch = selectSystem { x86_64-linux = ""; aarch64-linux = "-arm64"; }; in stdenv.mkDerivation { fetchzip { url = "https://download.jetbrains.com/toolbox/jetbrains-toolbox-${version}${arch}.tar.gz"; hash = selectSystem { x86_64-linux = "sha256-rq0Hn9g+/u9C8vbEVH2mv62c1dvxr+t9tBhf26swQgI="; aarch64-linux = "sha256-52wFejaKBSg/eeJu3NDGl1AdZLsJdi/838YeROD4Loc="; }; } + "/jetbrains-toolbox"; postExtract = '' patchelf --add-rpath ${lib.makeLibraryPath [ icu ]} $out/jetbrains-toolbox ''; }; 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 \ --append-flags "--update-failed" ''; }; darwin = stdenv.mkDerivation (finalAttrs: { inherit pname version src appimage passthru meta ; nativeBuildInputs = [ makeWrapper copyDesktopItems ]; 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-y0zXQEqY5lj/e440dRtyBfaw8CwqqgzO3Ujreb37Z/I="; aarch64-darwin = "sha256-9Bj5puG9NUHO53oXBRlB5DvX9jGTmrkDgjV2QPH9qg0="; }; }; nativeBuildInputs = [ undmg ]; sourceRoot = "JetBrains Toolbox.app"; installPhase = '' runHook preInstall install -Dm644 ${appimageContents}/.DirIcon $out/share/icons/hicolor/scalable/apps/jetbrains-toolbox.svg makeWrapper ${appimage}/bin/jetbrains-toolbox $out/bin/jetbrains-toolbox \ --append-flags "--update-failed" \ --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ icu ]} mkdir -p $out/Applications $out/bin cp -r . $out/Applications/"JetBrains Toolbox.app" ln -s $out/Applications/"JetBrains Toolbox.app"/Contents/MacOS/jetbrains-toolbox $out/bin/jetbrains-toolbox runHook postInstall ''; desktopItems = [ "${appimageContents}/jetbrains-toolbox.desktop" ]; # Disabling the tests, this seems to be very difficult to test this app. doCheck = false; passthru.updateScript = genericUpdater { versionLister = writeShellScript "jetbrains-toolbox-versionLister" '' curl -Ls 'https://data.services.jetbrains.com/products?code=TBA&release.type=release' \ | ${lib.getExe jq} -r '.[] | .releases | flatten[] | .build' ''; }; meta = { description = "Jetbrains Toolbox"; homepage = "https://jetbrains.com/"; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ AnatolyPopov ]; platforms = [ "x86_64-linux" ]; mainProgram = "jetbrains-toolbox"; }; } }); in if stdenv.hostPlatform.isDarwin then darwin else linux pkgs/by-name/je/jetbrains-toolbox/update.sh 0 → 100755 +41 −0 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #!nix-shell -i bash -p bash nix curl coreutils jq common-updater-scripts 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 '"') echo "latest version: $latestVersion" echo "current version: $currentVersion" if [[ "$latestVersion" == "$currentVersion" ]]; then echo "package is up-to-date" exit 0 fi linux_systems=( "x86_64-linux:" "aarch64-linux:-arm64" ) 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 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") hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch) update-source-version jetbrains-toolbox $latestVersion $hash --system=$arch --ignore-same-version done Loading
pkgs/by-name/je/jetbrains-toolbox/package.nix +90 −65 Original line number Diff line number Diff line { stdenv, lib, stdenv, appimageTools, fetchzip, copyDesktopItems, fetchurl, makeWrapper, runCommand, appimageTools, icu, genericUpdater, writeShellScript, jq, undmg, }: let pname = "jetbrains-toolbox"; version = "2.5.4.38621"; src = fetchzip { url = "https://download.jetbrains.com/toolbox/jetbrains-toolbox-${version}.tar.gz"; hash = "sha256-FQTw6LPLJV+lV546rFOi/503PuErJs4T5q9MNWwGYEs="; stripRoot = false; passthru.updateScript = ./update.sh; meta = { description = "Jetbrains Toolbox"; homepage = "https://jetbrains.com/"; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ AnatolyPopov ]; platforms = [ "aarch64-linux" "aarch64-darwin" "x86_64-linux" "x86_64-darwin" ]; mainProgram = "jetbrains-toolbox"; }; appimageContents = runCommand "${pname}-extracted" { nativeBuildInputs = [ appimageTools.appimage-exec ]; } '' appimage-exec.sh -x $out ${src}/jetbrains-toolbox-${version}/jetbrains-toolbox selectSystem = attrs: attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); # JetBrains ship a broken desktop file. Despite registering a custom # scheme handler for jetbrains:// URLs, they never mark the command as # being suitable for passing URLs to. Ergo, the handler never receives # its payload. This causes various things to break, including login. # Reported upstream at: https://youtrack.jetbrains.com/issue/TBX-11478/ sed -Ei '/^Exec=/s/( %U)?$/ %U/' $out/jetbrains-toolbox.desktop ''; linux = appimageTools.wrapAppImage rec { inherit pname version passthru meta ; appimage = appimageTools.wrapAppImage { src = appimageTools.extractType2 { inherit pname version; src = appimageContents; src = let arch = selectSystem { x86_64-linux = ""; aarch64-linux = "-arm64"; }; in stdenv.mkDerivation { fetchzip { url = "https://download.jetbrains.com/toolbox/jetbrains-toolbox-${version}${arch}.tar.gz"; hash = selectSystem { x86_64-linux = "sha256-rq0Hn9g+/u9C8vbEVH2mv62c1dvxr+t9tBhf26swQgI="; aarch64-linux = "sha256-52wFejaKBSg/eeJu3NDGl1AdZLsJdi/838YeROD4Loc="; }; } + "/jetbrains-toolbox"; postExtract = '' patchelf --add-rpath ${lib.makeLibraryPath [ icu ]} $out/jetbrains-toolbox ''; }; 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 \ --append-flags "--update-failed" ''; }; darwin = stdenv.mkDerivation (finalAttrs: { inherit pname version src appimage passthru meta ; nativeBuildInputs = [ makeWrapper copyDesktopItems ]; 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-y0zXQEqY5lj/e440dRtyBfaw8CwqqgzO3Ujreb37Z/I="; aarch64-darwin = "sha256-9Bj5puG9NUHO53oXBRlB5DvX9jGTmrkDgjV2QPH9qg0="; }; }; nativeBuildInputs = [ undmg ]; sourceRoot = "JetBrains Toolbox.app"; installPhase = '' runHook preInstall install -Dm644 ${appimageContents}/.DirIcon $out/share/icons/hicolor/scalable/apps/jetbrains-toolbox.svg makeWrapper ${appimage}/bin/jetbrains-toolbox $out/bin/jetbrains-toolbox \ --append-flags "--update-failed" \ --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ icu ]} mkdir -p $out/Applications $out/bin cp -r . $out/Applications/"JetBrains Toolbox.app" ln -s $out/Applications/"JetBrains Toolbox.app"/Contents/MacOS/jetbrains-toolbox $out/bin/jetbrains-toolbox runHook postInstall ''; desktopItems = [ "${appimageContents}/jetbrains-toolbox.desktop" ]; # Disabling the tests, this seems to be very difficult to test this app. doCheck = false; passthru.updateScript = genericUpdater { versionLister = writeShellScript "jetbrains-toolbox-versionLister" '' curl -Ls 'https://data.services.jetbrains.com/products?code=TBA&release.type=release' \ | ${lib.getExe jq} -r '.[] | .releases | flatten[] | .build' ''; }; meta = { description = "Jetbrains Toolbox"; homepage = "https://jetbrains.com/"; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ AnatolyPopov ]; platforms = [ "x86_64-linux" ]; mainProgram = "jetbrains-toolbox"; }; } }); in if stdenv.hostPlatform.isDarwin then darwin else linux
pkgs/by-name/je/jetbrains-toolbox/update.sh 0 → 100755 +41 −0 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #!nix-shell -i bash -p bash nix curl coreutils jq common-updater-scripts 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 '"') echo "latest version: $latestVersion" echo "current version: $currentVersion" if [[ "$latestVersion" == "$currentVersion" ]]; then echo "package is up-to-date" exit 0 fi linux_systems=( "x86_64-linux:" "aarch64-linux:-arm64" ) 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 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") hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch) update-source-version jetbrains-toolbox $latestVersion $hash --system=$arch --ignore-same-version done