Overriding / configuring `jetbrains.vmopts`

I’m looking for a way to override the vmopts that are passed to JetBrains derivations (e.g. Goland, Idea, Clion, etc.). It seems like this was the intention of making vmopts configurable.

Here’s parameter (from pkgs/top-level/all-packages.nix) I wish to configure:

  jetbrains = (recurseIntoAttrs (callPackages ../applications/editors/jetbrains {
    vmopts = config.jetbrains.vmopts or null;
    jdk = jetbrains.jdk;
  }) // {
    jdk = callPackage ../development/compilers/jetbrains-jdk {  };
  });

I’ve tried setting config.jetbrains.vmopts directly, and also an overlay:

self: super:
{
  jetbrains = super.jetbrains // {
    vmopts = ''
      -Xms8g
      -Xmx8g
    '';
  };
}

Neither seem to work. When I inspect ~/.config/JetBrains/GoLand2022.1/goland64.vmoptions, I don’t see the override.

There’s a few different layers of indirection that are making this tricky:

I feel like an overlay is what I want, but I’m missing something about how to write it correctly.

I’m trying to make this portable enough to work on NixOS, but also with standalone home-manager setups, on both Linux and Darwin.

1 Like