How to override a package's input in configuration.nix?

#1

For instance, I want yarn package to use pkgs.nodejs-10_x instead of pkgs.nodejs (currently point to 8.x).
In yarn’s source code, I see buildInputs = [ nodejs ];
so I have the following in my configuration.nix:

let
my-yarn = pkgs.yarn.override {nodejs=pkgs.nodejs-10_x;};
in
{
environment.systemPackages = [my-yarn ...];
}

but it doesn’t work. Did I misunderstand anything?

0 Likes

#2

The override method will change the attributes given to the mkDerivation function, used for example for changing, the source, name, patches, version, etc.
You want to change the inputs which are passed to the package - for that you’ll have to use the overrideAttrs function, see the manual section for more detail.

1 Like