Skip to content

Instantly share code, notes, and snippets.

@amanjeev
Created February 10, 2021 23:11
Show Gist options
  • Save amanjeev/40eeadc54b064022efb3ee4cb90cc620 to your computer and use it in GitHub Desktop.
Save amanjeev/40eeadc54b064022efb3ee4cb90cc620 to your computer and use it in GitHub Desktop.
# A trial to create Jetbrains Toolbox package
{ pkgs ? import <nixpkgs> {} }:
let
name = "jetbrains-toolbox";
version = "1.20.7940";
sha256 = "c156beff24fb6cb1cd5880c5faa9fb65d70dcb93ac7601217574d4e5c9aaad35";
jt = pkgs.stdenv.mkDerivation {
inherit name version sha256;
src = pkgs.fetchurl {
url = "https://download.jetbrains.com/toolbox/${name}-${version}.tar.gz";
sha256 = "${sha256}";
};
buildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
mkdir -p "$out/lib/jetbrains-toolbox" "$out/bin"
tar -zxf "$src" -C "$out/lib/jetbrains-toolbox" --strip-components 1
ln -s "$out/lib/jetbrains-toolbox/jetbrains-toolbox" "$out/bin"
fixupPhase
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${pkgs.lib.makeLibraryPath [pkgs.fuse pkgs.libcef pkgs.xorg.libX11 pkgs.xorg.libxcb pkgs.xorg.xcbutilkeysyms pkgs.xorg.libXrandr ]}:$out/lib/jetbrains-toolbox" \
"$out/lib/jetbrains-toolbox/jetbrains-toolbox"
'';
};
in pkgs.buildFHSUserEnv {
name = "jetbrains-toolbox";
targetPkgs = pkgs: [
jt
pkgs.zlib
];
runScript = "jetbrains-toolbox";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment