tweag / opam-nix

Turn opam-based OCaml projects into Nix derivations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why dontPatchShebangsEarly?

rizo opened this issue · comments

This is more of a question than an issue but why does opam-nix use dontPatchShebangsEarly instead of a more common name dontPatchShebangs?

As part of our build process we run dune subst which will invoke git to obtain the current revision, setting dontPatchShebangsEarly is important to avoid the -dirty suffix in the version. I spent a few hours debugging this until realised that the builder in opam-nix does not use dontPatchShebangs.

stdenv only applies patchShebangs to the output of the derivation during fixupPhase, while we need to run it on the derivation source during the configurePhase. However, it is important that we can disable it (for cases like yours), so it is controlled with dontPatchShebangsEarly :)

Oh, I see. I didn't know that patchShebangs was applied after, but I guess it makes sense.