jetbrains: configurable vmoptions

All products are now configurable through `config.jetbrains.vmoptions`

Closes #107032
This commit is contained in:
Edward Tjörnhammar 2020-12-19 23:14:02 +01:00
parent 83bd601310
commit e3c8f10cbb
No known key found for this signature in database
GPG Key ID: 577898458385603E
3 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,6 @@
{ stdenv, lib, makeDesktopItem, makeWrapper, patchelf
{ stdenv, lib, makeDesktopItem, makeWrapper, patchelf, writeText
, coreutils, gnugrep, which, git, unzip, libsecret, libnotify
, vmopts ? null
}:
{ name, product, version, src, wmClass, jdk, meta }:
@ -9,6 +10,11 @@ with stdenv.lib;
let loName = toLower product;
hiName = toUpper product;
execName = concatStringsSep "-" (init (splitString "-" name));
vmoptsName = loName
+ ( if (with stdenv.hostPlatform; (is32bit || isDarwin))
then ""
else "64" )
+ ".vmoptions";
in
with stdenv; lib.makeOverridable mkDerivation rec {
@ -26,6 +32,8 @@ with stdenv; lib.makeOverridable mkDerivation rec {
'';
};
vmoptsFile = optionalString (vmopts != null) (writeText vmoptsName vmopts);
nativeBuildInputs = [ makeWrapper patchelf unzip ];
patchPhase = lib.optionalString (!stdenv.isDarwin) ''
@ -72,7 +80,8 @@ with stdenv; lib.makeOverridable mkDerivation rec {
--set JDK_HOME "$jdk" \
--set ${hiName}_JDK "$jdk" \
--set ANDROID_JAVA_HOME "$jdk" \
--set JAVA_HOME "$jdk"
--set JAVA_HOME "$jdk" \
--set ${hiName}_VM_OPTIONS ${vmoptsFile}
ln -s "$item/share/applications" $out/share
'';

View File

@ -2,12 +2,13 @@
, python
, jdk, cmake, libxml2, zlib, python3, ncurses5
, dotnet-sdk_3
, vmopts ? null
}:
with stdenv.lib;
let
mkJetBrainsProduct = callPackage ./common.nix { };
mkJetBrainsProduct = callPackage ./common.nix { inherit vmopts; };
# Sorted alphabetically
buildClion = { name, version, src, license, description, wmClass, ... }:

View File

@ -21648,6 +21648,7 @@ in
};
jetbrains = (recurseIntoAttrs (callPackages ../applications/editors/jetbrains {
vmopts = config.jetbrains.vmopts or null;
jdk = jetbrains.jdk;
}) // {
jdk = callPackage ../development/compilers/jetbrains-jdk { };