How to patch absolute path?

I have a python packages. Inside its code there is an invocation of a binary by an absolute path /usr/bin/prog. How do I patch it an make it call the same binary but from nix store?

The closes thing to what I want is a patchShebangs, but I don’t have a shebang here, unfortunately.

Can you point to an example of what the source-to-be-patched looks like?

Actually, I found out that I can specify the path to the binary in the config file. But I’d still like to know the answer just in case I need it in the future.

The source looks like this — osc/osc/conf.py at 2d3a434b7a664ded7e975f84154ebb01850d3efd · openSUSE/osc · GitHub.

In your case using substituteInPlace inside a postPatch block is the best way to go. It is a fancy sed but it exists for a reason. :wink:

1 Like

Nice, thank you! Nixpkgs Reference Manual seems to be full of secret gems like this.