How can I do a simple overlay with a complicated .nix file?

Hi, I am a beginner of NixOS.
I want to remove just one line in the tor-browser/default.nix file:

It can be achieved by duplicating the file into other place, modify it, and then install it in environment.systemPackages = []; by ( callPackage ./somewhere/default.nix {} ).
However in this way I cannot get the update of tor-browser.

I think overlay is a better approach. However I am not capable of writing an overlay for such a complicated nix file.
Please help! Thank you very much!

overrideAttrs and apply builtins.replaceStrings to previousAttrs.buildPhase

2 Likes

Thanks for the hint!
This is the overlays that I am using now!

final: prev:{
  tor-browser = prev.tor-browser.overrideAttrs(o: {
    buildPhase = builtins.replaceStrings [ "-no-remote" ] [ "" ] o.buildPhase;
  });
}