Apply a patch to a specific file inside a package?

Hey I finally got a proper solution for this! Making tramp use melpaBuild instead of elpaBuild allows me to patch tramp properly! Also it’s possible to declare the overrides for Emacs packages with Home-manager’s programs.emacs module (but you have to choose between either emac-overlay’s way or Home-manager.
As what jian-lin over on the issue posted, setting the override as the following below makes tramp use melpaBuild properly.

programs.emacs = {
  enable = true;
  overrides = final: prev: {
    tramp = final.melpaBuild {
      inherit (prev.tramp) pname version src;
      patches = (prev.tramp.patches or [ ]) ++ [ ./your-patch ];
      commit = "1";
      recipe = pkgs.writeText "recipe" ''
        (tramp :repo "foo/bar" :fetcher github)
      '';
    };
  };
};

Reference: Use emacsWithPackagesFromUsePackage with Doom Emacs, trying to apply a patch to a ELPA package · Issue #386 · nix-community/emacs-overlay · GitHub

1 Like