Skip to content

Instantly share code, notes, and snippets.

@SrTobi
Last active August 29, 2022 23:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SrTobi/ee6104514e2f14a0f1eae201654f2012 to your computer and use it in GitHub Desktop.
Save SrTobi/ee6104514e2f14a0f1eae201654f2012 to your computer and use it in GitHub Desktop.
Example of a custom package for your configuration.nix
{ pkgs, stdenv, fetchurl, ... }:
let
name = "jetbrains-toolbox";
version = "1.16.6319";
#version = "1.18.7455";
sha256 = "4e6f333839af8330a09d9d6fdcd6a635c9ca1f0ae239d8f268249dbd095ca880";
jetbrains-toolbox-src = stdenv.mkDerivation {
name = "${name}-src";
src = fetchurl {
url = "https://download.jetbrains.com/toolbox/${name}-${version}.tar.gz";
inherit sha256;
};
installPhase = ''
#mkdir -p $out/bin
cp jetbrains-toolbox $out
'';
};
jetbrains-toolbox-f = extraPkgs: pkgs.appimageTools.wrapType2 {
inherit name;
src = jetbrains-toolbox-src;
extraPkgs = pkgs: with pkgs; [
libcef
] ++ extraPkgs;
meta = with stdenv.lib; {
description = "A toolbox to manage JetBrains products";
longDescription = ''
The JetBrains Toolbox lets you install and manage JetBrains Products in muiltiple versions.
'';
homepage = "https://www.jetbrains.com/toolbox/";
platforms = platforms.all;
};
};
makeWithExtraPackages = f: origArgs:
let origRes = f origArgs;
in origRes // { withExtraPkgs = newArgs: (f newArgs); };
in makeWithExtraPackages jetbrains-toolbox-f []
#!/usr/bin/env bash
# Reference: https://github.com/nagygergo/jetbrains-toolbox-install/blob/master/jetbrains-toolbox.sh
TOOLBOX_URL=$(curl --silent 'https://data.services.jetbrains.com//products/releases?code=TBA&latest=true&type=release' \
-H 'Origin: https://www.jetbrains.com' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.8' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Referer: https://www.jetbrains.com/toolbox/download/' \
-H 'Connection: keep-alive' \
-H 'DNT: 1' \
--compressed \
| grep -Po '"linux":.*?[^\\]",' \
| awk -F ':' '{print $3,":"$4}'| sed 's/[", ]//g')
echo ${TOOLBOX_URL}
curl -sL ${TOOLBOX_URL}.sha256
# This is a module.
# Import it from your configuration.nix
{ pkgs, config, ... }:
{
environment.systemPackages = with pkgs; [
# make toolbox depend on fontPackages to use all installed fonts
(jetbrains-toolbox.withExtraPkgs config.fonts.fontconfig.confPackages)
];
nixpkgs.config.packageOverrides = pkgs: {
jetbrains-toolbox = pkgs.callPackage ./jetbrains-toolbox {};
};
}
@drupol
Copy link

drupol commented Jun 3, 2021

Hi,

Could you please list the steps in order to install this?

Thanks!

@drupol
Copy link

drupol commented Jun 3, 2021

Found it!

  1. Copy jetbrains-toolbox.nix in /etc/nixos/jetbrains-toolbox/default.nix
  2. Copy packages-module.nix in /etc/nixos/packages-module.nix
  3. Edit /etc/nixos/configuration.nixand add a new import: packages.module.nix

Then

nixos-rebuild switch

I think we should make this an official package!

@SrTobi
Copy link
Author

SrTobi commented Jun 4, 2021

Found it!

👍

I think we should make this an official package!

Unfortunately this has some massive problems... first and foremost it is an old toolbox version from like 9 month ago, I think. After that they changed something and the above doesn't work... I wanted to look into this again, but I didn't yet...

There is stuff that is missing in the env, I was also not able to fix... for example you cannot use git command in an installed intellij terminal/started program, because certain ssl certificates are missing from the env's /etc/certs/.

@drupol
Copy link

drupol commented Jun 4, 2021

Unfortunately this has some massive problems... first and foremost it is an old toolbox version from like 9 month ago, I think. After that they changed something and the above doesn't work... I wanted to look into this again, but I didn't yet...

I was about to comment that ! Indeed, I can install the package but I'm unable to run it.

There is stuff that is missing in the env, I was also not able to fix... for example you cannot use git command in an installed intellij terminal/started program, because certain ssl certificates are missing from the env's /etc/certs/.

This is so sad.

I guess such things are massively slowing down the adoption of Nixos.

@SrTobi
Copy link
Author

SrTobi commented Jun 4, 2021

I guess such things are massively slowing down the adoption of Nixos.

Yeah, nixos is a great idea, I really mean that. But the problem is that all the software is developed for a system that works different... and NixOS has to work with that... Still I will continue using it...

@KonradKuznicki
Copy link

I've spent some time with this problem and got some additional piece of the puzzle

$ APPIMAGE_DEBUG_EXEC=bash ./result/bin/jetbrains-toolbox -d

this helped me to jump into the AppImage and manually running ./jetbrains-toolbox returned

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

this looks like some missing java libraries
but it might be an outcome of me not knowing what I'm doing

@drupol
Copy link

drupol commented Oct 26, 2021

How about running it in a steam env ? I think it would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment