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

Add 'extraLdPath' option to JetBrains products & Fix JDK download fea… #112268

Merged
merged 2 commits into from Feb 17, 2021
Merged

Add 'extraLdPath' option to JetBrains products & Fix JDK download fea… #112268

merged 2 commits into from Feb 17, 2021

Conversation

gytis-ivaskevicius
Copy link
Contributor

@gytis-ivaskevicius gytis-ivaskevicius commented Feb 7, 2021

Fixes #93829
Tested with multiple jdk's - seems to work great

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@gytis-ivaskevicius
Copy link
Contributor Author

gytis-ivaskevicius commented Feb 7, 2021

If some peeps stumble across this PR and it's not merged yet - may I suggest patching your own channel using this PR :D
Here is how:
https://github.com/gytis-ivaskevicius/nixfiles/blob/master/flake.nix#L30-L35
https://github.com/gytis-ivaskevicius/nixfiles/blob/master/utility-functions.nix#L15-L19

@r-rmcgibbo
Copy link

Result of nixpkgs-review pr 112268 at 07981a5 run on aarch64-linux 1

2 packages failed to build:
2 warnings produced:
  • warning: missing-phase-hooks

    installPhase should probably contain runHook preInstall and runHook postInstall.

    Near pkgs/applications/editors/jetbrains/common.nix:64:3:

       |
    64 |   installPhase = ''
       |   ^
    
  • warning: patch-phase

    patchPhase should not be overridden, use postPatch instead.

    Near pkgs/applications/editors/jetbrains/common.nix:39:3:

       |
    39 |   patchPhase = lib.optionalString (!stdenv.isDarwin) ''
       |   ^
    

@r-rmcgibbo
Copy link

Result of nixpkgs-review pr 112268 at 07981a5 run on x86_64-linux 1

2 packages built:
2 warnings produced:
  • warning: missing-phase-hooks

    installPhase should probably contain runHook preInstall and runHook postInstall.

    Near pkgs/applications/editors/jetbrains/common.nix:64:3:

       |
    64 |   installPhase = ''
       |   ^
    
  • warning: patch-phase

    patchPhase should not be overridden, use postPatch instead.

    Near pkgs/applications/editors/jetbrains/common.nix:39:3:

       |
    39 |   patchPhase = lib.optionalString (!stdenv.isDarwin) ''
       |   ^
    

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/346

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff LGTM

@gytis-ivaskevicius
Copy link
Contributor Author

gytis-ivaskevicius commented Feb 16, 2021

I just realized that this fixes the issue only due to this Lil script that I had for ages in my config:

 system.activationScripts.ldso = lib.stringAfter [ "usrbinenv" ] ''
    mkdir -m 0755 -p /lib64
    ln -sfn ${pkgs.glibc.out}/lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2.tmp
    mv -f /lib64/ld-linux-x86-64.so.2.tmp /lib64/ld-linux-x86-64.so.2 # atomically replace
  '';

which makes me question if this PR is valid.... :/

On one hand, it does not fix the problem (and to me, it seems that there is no fix without changes on JetBrain's side). On another hand, this PR makes it (much) easier to get this Intellij feature to work on NixOS.

Also, may I add that the /lib64/ld-linux-x86-64.so.2 is also necessary for certain gradle/maven plugins to work which makes it necessary in some cases.

TL;DR: I guess I would still rather have this PR merged especially since it does not add any extra dependencies but I would understand if it were to get rejected.

EDIT:
Does not work with ld-nix since Intelij gets rid of most env variables. Error:

Abnormal build process termination: 
/home/gytis/.jdks/openjdk-15.0.2/bin/java -Xmx700m -Djava.awt.headless=true -Djdt.compiler.useSingleThread=true ......whole metric ton of arguments....
cannot execute /home/gytis/.jdks/openjdk-15.0.2/bin/java: NIX_LD or NIX_LD_x86_64-linux is not set

From my point of view, this makes this PR the only "sane" option to persist this feature. Other options:

  1. Set global LD_LIBRARY_PATH
  2. Execute application from FHS env
  3. overrideAttrs whole stage
    All three of these options have obvious downsides. Can we please merge it? :/

@SuperSandro2000
Copy link
Member

This is a semi-automatic executed nixpkgs-review with nixpkgs-review-checks extension. It is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch).
If you have any questions or problems please reach out to SuperSandro2000 on IRC.

Result of nixpkgs-review pr 112268 run on x86_64-linux 1

2 packages built:
  • jetbrains.idea-community
  • jetbrains.idea-ultimate

The following issues got detected with the above build packages.
Please fix at least the ones listed with your changed packages:

jetbrains.idea-community:

patchPhase should not be overridden, use postPatch instead.

Near pkgs/applications/editors/jetbrains/common.nix:39:3:

   |
39 |   patchPhase = lib.optionalString (!stdenv.isDarwin) ''
   |   ^

See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/patch-phase.md
installPhase should probably contain runHook preInstall and runHook postInstall.

Near pkgs/applications/editors/jetbrains/common.nix:64:3:

   |
64 |   installPhase = ''
   |   ^

See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/missing-phase-hooks.md
URI literals are deprecated.
Near pkgs/applications/editors/jetbrains/default.nix:148:20:

    |
148 |         homepage = https://www.jetbrains.com/mps/;
    |                    ^

See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/no-uri-literals.md

jetbrains.idea-ultimate:

patchPhase should not be overridden, use postPatch instead.

Near pkgs/applications/editors/jetbrains/common.nix:39:3:

   |
39 |   patchPhase = lib.optionalString (!stdenv.isDarwin) ''
   |   ^

See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/patch-phase.md
installPhase should probably contain runHook preInstall and runHook postInstall.

Near pkgs/applications/editors/jetbrains/common.nix:64:3:

   |
64 |   installPhase = ''
   |   ^

See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/missing-phase-hooks.md
URI literals are deprecated.
Near pkgs/applications/editors/jetbrains/default.nix:148:20:

    |
148 |         homepage = https://www.jetbrains.com/mps/;
    |                    ^

See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/no-uri-literals.md

@edwtjo edwtjo merged commit c144178 into NixOS:master Feb 17, 2021
@gytis-ivaskevicius gytis-ivaskevicius deleted the fix/intellij-jdks-download branch February 17, 2021 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jetbrains.idea-ultimate: Needs FHS to run downloaded JDKs
5 participants