tweag / opam-nix

Turn opam-based OCaml projects into Nix derivations
MIT License
111 stars 33 forks source link

Why dontPatchShebangsEarly? #7

Closed rizo closed 2 years ago

rizo commented 2 years ago

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.

balsoft commented 2 years ago

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 :)

rizo commented 2 years ago

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