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


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:

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

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



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