Overriding Jetbrains package versions

Hi, new-ish to NixOS here.
I use Jetbrains Rider and noticed that the ‘jetbrains.rider’ package does not currently install the latest version.
So I thought I could maybe override the version somehow locally.
I went to check the nix source code at https://github.com/NixOS/nixpkgs/blob/f2c62a920f99c7f657dd1e84ee6ce58bfea1775c/pkgs/applications/editors/jetbrains/default.nix but it doesn’t seem to be overridable?
I tried:

     (jetbrains.rider.override rec {
       version = "2019.3.4";
       src = fetchurl {
        url = "https://download.jetbrains.com/rider/JetBrains.Rider-${version}.tar.gz";
        sha256 = "0cs8fc3h6d2m84ppiqjy0f3xklpc5gf0i6c4bzv04y8ngh0cwgl2";

but it throws:

error: anonymous function at /nix/store/1y339mhzlflkd5w9mdms9j8yrg4w3wq0-source/pkgs/applications/editors/jetbrains/default.nix:1:1 called with unexpected argument 'version', at /nix/store/1y339mhzlflkd5w9mdms9j8yrg4w3wq0-source/lib/customisation.nix:133:63

Also am I right in thinking that the buildRider function isn’t public so I can’t call it? If so, why?


I would have thought that should work too, since override is for overriding a function argument set, and version is clearly an argument to buildRider. I’m still trying to grasp this, but my guess is that since buildRider is ultimately a mkDerivation function, you should use overrideAttrs. But overrideAttrs is not available for jetbrains.rider - probably because buildRider starts off with an overrideDerivation. I finally managed to get it working with this overlay:

(self: super:
    jetbrains = super.jetbrains // {
      rider = super.jetbrains.rider.overrideDerivation (_: rec {
        name = "rider-${version}";
        version = "2020.1.3";

        src = super.fetchurl {
          url = "https://download.jetbrains.com/rider/JetBrains.Rider-${version}.tar.gz";
          sha256 = "1zzkd3b5j3q6jqrvibxz33a4fcm7pgqfx91bqjs615v3499ncng7";

As far as I understand, dropping the super.jetbrains // and using overrideAttrs instead of overrideDerivation is preferred over this, but as I said, overrideAttrs is not available.


FWIW since my original post I’ve just switched to using my own fork of the nixpkgs repo.

so I just configure it however I like and then I can install it like this in my configuration.nix :

(import (fetchTarball https://github.com/mausch/nixpkgs/archive/593678b8eb09b6b2de7a5a186db59dd3224b0463.tar.gz) {}).jetbrains.rider

(or import at the top then reference the package, etc)

With the lack of types in nix it’s really hard to follow what’s going on, I’ve already spent too much time guessing what’s needed. Hopefully I’ll grok it at some point, eventually.

if you used overrideAttrs and just passed a new src, it would have likely worked.

override will pass new inputs into your expression, overrideAttrs will override the attrs in the body of the expression, and overrideDerivation will override the drv (other two overrides should be preferred)

This conversation came up in my search for how best to do this today while trying to roll my IDE back to a version I have a fallback license for, so I thought it might help to share here this is indeed quite straightforward to do with the current version of the package; I just have this override in my home-manager packages list:

        (jetbrains.idea-ultimate.overrideAttrs {
          version = "2022.3.3";
          src = fetchurl {
            url = "https://download.jetbrains.com/idea/ideaIU-2022.3.3.tar.gz";
            sha256 = "c302bd84b48a56ef1b0f033e8e93a0da5590f80482eae172db6130da035314a6";

JB publish the checksums for their downloads too, so this was actually quite easy to achieve in the end. The expression for all the JetBrains IDEs is quite similar now too, so I suspect this override would work for any of the other editors covered by this package.