Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jetbrains: set JDK for newer JetBrains Client versions #249699

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yrd
Copy link
Member

@yrd yrd commented Aug 17, 2023

Description of changes

This is a follow-up to 2b387a0 (#195132). It seems that the corresponding environment variable containing the JDK path has changed in the newest JetBrains Client update.

Here are the relevant parts of JetBrains' launch scripts (both downloaded by the Gateway application):

Version 231

~/.cache/JetBrains/JetBrainsClientDist/JetBrainsClient-231.9225.16.tar.gz-dac85b49af.ide.d/JetBrainsClient-231.9225.16/bin/jetbrains_client.sh:

# ---------------------------------------------------------------------
# Locate a JRE installation directory command -v will be used to run the IDE.
# Try (in order): $JETBRAINSCLIENT_JDK, .../jetbrains_client.jdk, .../jbr, $JDK_HOME, $JAVA_HOME, "java" in $PATH.
# ---------------------------------------------------------------------
JRE=""

# shellcheck disable=SC2154
if [ -n "$JETBRAINSCLIENT_JDK" ] && [ -x "$JETBRAINSCLIENT_JDK/bin/java" ]; then
  JRE="$JETBRAINSCLIENT_JDK"
fi

Version 232

~/.cache/JetBrains/JetBrainsClientDist/JetBrainsClient-232.8660.185.tar.gz-7fa3e49d2f.ide.d/JetBrainsClient-232.8660.185/bin/jetbrains_client.sh:

# ---------------------------------------------------------------------
# Locate a JRE installation directory command -v will be used to run the IDE.
# Try (in order): $JETBRAINS_CLIENT_JDK, .../jetbrains_client.jdk, .../jbr, $JDK_HOME, $JAVA_HOME, "java" in $PATH.
# ---------------------------------------------------------------------
JRE=""

# shellcheck disable=SC2154
if [ -n "$JETBRAINS_CLIENT_JDK" ] && [ -x "$JETBRAINS_CLIENT_JDK/bin/java" ]; then
  JRE="$JETBRAINS_CLIENT_JDK"
fi

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@kouyk
Copy link
Contributor

kouyk commented Sep 22, 2023

Is it better if we just remove the old environment variable as well? AFAIK there isn't any other IDEs that rely on it. Would have been nice is this change was made together with the corresponding client update so it's easier to keep track.

Also, I haven't been using Jetbrains products for a while so I can't test them (should probably remove myself as the maintainer of the gateway application as well).

@dritter
Copy link
Contributor

dritter commented Sep 25, 2023

Hmm. I have a hard time testing this. I always get 231.8770.68 as client:
image

How can I force an update?

But besides that, I guess that an additional variable won't do any harm..

@yrd
Copy link
Member Author

yrd commented Sep 25, 2023

@dritter are you connecting to a NixOS host? You'll need to register the IDE installation as a backend:

# On the remote server:
idea-ultimate-remote-dev-server registerBackendLocationForGateway

Then it typically appears in the menu inside Gateway.

@icewind1991
Copy link
Contributor

I've applied the changes manually with an overlay:

  jetbrains = prev.jetbrains // {
    gateway = prev.jetbrains.gateway.overrideAttrs (old: {
      installPhase = builtins.replaceStrings ["JETBRAINSCLIENT_JDK"] ["JETBRAINS_CLIENT_JDK"] old.installPhase;
    });
  };

and can confirm that this fixes connecting to remote instances.

@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants