How to override postFixup in overlay

I’m facing a problem with Microsoft Teams that should be solvable by renaming one of the files installed with nixos.teams.

Based on my understanding, which clearly is wrong or insufficient, I was expecting to fix it with this overlay:

self: super: {
  teams = super.teams.overrideAttrs (oldAttrs: rec{
    # https://docs.microsoft.com/en-us/answers/questions/42095/sharing-screen-not-working-anymore-bug.html
    postFixup = super.postFixup + ''
      rm $out/opt/teams/resources/app.asar.unpacked/node_modules/slimcore/bin/rect-overlay
    '';
  });
}

but I get this error:

desktop:~$ nix-shell --show-trace -p teams --run teams
error: while evaluating the attribute 'buildInputs' of the derivation 'shell' at /nix/store/jv3mxf7mzpnh0wfg55ngqal2xcn30493-nixos-20.03.3191.504f993df9a/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'postFixup' of the derivation 'teams-1.3.00.16851' at /nix/store/jv3mxf7mzpnh0wfg55ngqal2xcn30493-nixos-20.03.3191.504f993df9a/nixos/pkgs/stdenv/generic/make-derivation.nix:191:11:
attribute 'postFixup' missing, at /etc/nixos/overlays/teams.nix:8:17

I understand the manual such that overrideAttrs is supposed to be used for overriding attributes, and I think postFixup is an attribute of nixos.teams.

Can anyone help me understand how postFixup is not an attribute of teams, and also how to make an overlay that implements the fix? Cheers :slight_smile:

You accidentally used super.postFixup instead of oldAttrs.postFixup.

1 Like

You are absolutely right!
This works as intended:

self: super: {
  teams = super.teams.overrideAttrs (oldAttrs: rec{
    # https://docs.microsoft.com/en-us/answers/questions/42095/sharing-screen-not-working-anymore-bug.html
    postFixup = oldAttrs.postFixup + ''
      rm $out/opt/teams/resources/app.asar.unpacked/node_modules/slimcore/bin/rect-overlay
    '';
  });
}