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 nixpkgs/default.nix at f2c62a920f99c7f657dd1e84ee6ce58bfea1775c · NixOS/nixpkgs · GitHub 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?

Thanks

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.

2 Likes

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)