Skip to content

Inject version into basalt exec at build time

Madeline Haraj requested to merge revision into develop

Summary

In the first iteration of this feature, it only worked in a cabal build inside the shell. In the second iteration, the entire git repo was brought along as a dependency at runtime to be queried for revision information.

This iteration grabs the revision information at compile time by parsing the ref files directly, without git, and thus avoiding a huge impure dependency on the entire git store.

However, we still use fetchGit to determine whether the repository is dirty, since it seems prudent to mark the version as dirty if it is. This is less pure! If we want to be more pure, we can just use the revision information and trust that we are not distributing binaries that are built from a dirty checkout.

Not going to mark as dirty, so that development isn't stymied.

Future work: Split the expression out for basalt so that it takes the git information in parameters that hydra or another CI would pass into it. Use a program wrapper instead to embed the revision information, so that trivial changes to the repo don't require the package as such to be rebuilt.

Checklist for success

  • I have updated the changelog. (not needed)
  • I have updated the README for any non-trivial changes. (not needed)
  • My code is consistent with the Obsidian style guide.
Edited by Madeline Haraj

Merge request reports