-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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: respect boot java runtime settings #306712
base: master
Are you sure you want to change the base?
jetbrains: respect boot java runtime settings #306712
Conversation
aa5c297
to
88cb12f
Compare
88cb12f
to
d5f0a46
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/4037 |
@liff I am sorry to bother you. Could you please take a look at this PR as well? Many thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patching the upstream launcher script seems rather brittle. Would you be able to achieve the desired result by overriding the jdk
argument, like: jetbrains.mps.override { jdk = some-other-jdk; }
? Or alternatively, setting MPS_JDK
to an empty string?
Overriding |
Strictly speaking, one can also type |
Because bash always seems a bit dark magic to me, i'll have to base my comment on your issue description instead. Will this always override the boot JDK for all IDEs as long as you have one laying around in the correct directory? That seems like it could be rather problematic on updates? It also kinda goes against Nix's whole "Everything is deterministic/isolated/reproducible" thought? I know the IDE already has a way of controlling this internally, could we do something so that can work correctly instead, or is that was this attempts to do? |
Result of 2 packages failed to build:
16 packages built:
|
The
Here is an excerpt of the upstream script from Intellij 2024.1.3: if [ -z "$JRE" ] && [ -s "${CONFIG_HOME}/JetBrains/IntelliJIdea2024.1/idea.jdk" ]; then
USER_JRE=$(cat "${CONFIG_HOME}/JetBrains/IntelliJIdea2024.1/idea.jdk")
if [ -x "$USER_JRE/bin/java" ]; then
JRE="$USER_JRE"
fi
fi It will load To answer your first question, no, not all configurations of all IDEs are overridden at the same time. If the user selects a different JVM for a specific release of an IDE, it will be overridden for this one until they change it or remove the customization. The configurations of other IDEs are untouched. Note that different releases of a single IDE use different configurations. In the case of updates, the user has to reassess the situation and decide whether they want to apply another override to the new configuration. Because the
What this patch attempts to achieve is just this: to not set arbitrary values for the |
This is due to the upgrade to JBR 21 in #318036. It will be resolved later with another PR. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/4267 |
Description of changes
All JetBrain IDEs support setting the boot-time Java runtime, which is helpful in some cases. For example, I had the issue of
error reading /nix/store/liz01j673lwb0wzkrykg39a7z388fy41-mps-2023.2/mps/lib/app.jar; Invalid CEN header (invalid zip64 extra data field size)
with an old version of JetBrains MPS. Similar issues have been reported and the recommended solution at the time was to change the boot-time JDK.This setting can be changed, for example, as described here for MPS, but also similarly for other JetBrains IDEs, by creating
*.jdk
files in~/.config/JetBrains/*
. JetBrain's scripts will then load them for the boot time JDKs. For example,~/.config/JetBrains/MPS2023.3/mps.jdk
is generated for MPS 2023.3 and~/.config/JetBrains/IntelliJIdea2024.1/idea.jdk
is generated for IntelliJ Ultimate 2024.1.Unfortunately, the current wrapper scripts ignore such settings and always enforce the Java runtime chosen at installation time.
This PR fixes the wrapper scripts so that they respect boot-time JDK settings. It achieves the goal by tweaking the procedure that sets environment variables. For example, while the two variables were set directly for MPS as below:
They are now only set when boot-time JDKs are not set, as below:
Loading of
*.jdk
files is then delegated to the corresponding upstream scripts. Note also that the*.vmoptions
files are also treated specially.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.