How to get the package source with patches applied?

I’m working on updating omnisharp-roslyn to use buildDotnetModule - omnisharp-roslyn: use buildDotnetModules by mdarocha · Pull Request #178004 · NixOS/nixpkgs · GitHub

buildDotnetModule has a passthru script fetch-deps, which gets the source of the package from the src attribute and uses it to generate a dependencies lockfile.

Hovewer, for this operation to perform properly, the source of omnisharp-roslyn has to be patched. This patch executes during build time in a postFixup hook, but does not execute when loading the source from the src attribute - it loads the source as-is from github, which doesn’t work.

Is there any way to get the package source with hooks and patches applied?

pkgs.srcOnly, however it only executes unpackPhase and patchPhase. Things modifying the source should be done in patchPhase always anyways.

2 Likes

Thanks, that worked!