Help with overrideAttrs

I would like to globally change the value of the packageOverrides argument in the octoprint package:

I have tried to create an overlay to accomplish this.

nixpkgs.overlays = [(self: super: {
  octoprint = super.octoprint.overrideAttrs = (oldAttrs: rec {
    packageOverrides = thePlugin;
  });
})];

But that does not seem to change anything.
I also tried printing the oldAttrs variable using builtins.trace, but the printed set does not contain any of the parameters of the octoprint package.

Am I missing something?

Turns out I need override instead of overrideAttrs, but I don’t really get why.
I thought overrideAttrs was for parameters and override for members of the resulting package…

It is the other way around. overrideAttrs modifies the attributes passed to stdenv.mkDerivation, while override modifies the arguments passed to the package function by lib.callPackage.

There are some other attribute sets that contain different override function, for example, python3.pkgs.buildPythonPackage uses overridePythonAttrs, stuff created using lib.makeOverridable like the packages in nodePackages use override (this is probably where your confusion comes from)…

There is a RFC to get these functions more under control: [RFC 0067] Common override interface derivations by FRidh · Pull Request #67 · NixOS/rfcs · GitHub