Skip to content

Add self package to flake.nix, nix fixes, fmt#203

Open
KaiSforza wants to merge 1 commit into
clawscli:mainfrom
KaiSforza:kai/nixupdates
Open

Add self package to flake.nix, nix fixes, fmt#203
KaiSforza wants to merge 1 commit into
clawscli:mainfrom
KaiSforza:kai/nixupdates

Conversation

@KaiSforza

Copy link
Copy Markdown
  • Added a default/clawscli package that builds this project. Note, vendorHash has to be set when the dependencies change.
  • Uses the same flags as in the .goreleaser.yml
  • Uses self for automatic version options using the hash of the current git revision. Uses the dirtyShortRev if it is available so that builds and versions show that there are changes to the working copy. Nix already takes care of making the output different, so no bumping versions are necessary to do nix build ...
  • Formatted the flake.nix using nixfmt.
  • Used built-in stdenv.targetPlatform.node variables for fetching indexion, set meta.platforms to limit where it can run.
  • Added nix info to the README.

* Added a `default`/`clawscli` package that builds this project. Note,
  `vendorHash` has to be set when the dependencies change.
* Uses the same flags as in the `.goreleaser.yml`
* Uses `self` for automatic version options using the hash of the current
  git revision. Uses the `dirtyShortRev` if it is available so that
  builds and versions show that there are changes to the working copy.
  Nix already takes care of making the output different, so no bumping
  versions are necessary to do `nix build ...`
* Formatted the flake.nix using `nixfmt`.
* Used built-in `stdenv.targetPlatform.node` variables for fetching
  indexion, set `meta.platforms` to limit where it can run.
* Added nix info to the README.

@yimsk yimsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the Nix package and installation instructions.

It would be good to add a workflow that builds the Nix package itself. The current workflows run the Go build/tests and nix develop, but they do not run nix build .#clawscli. As a result, if vendorHash becomes stale after a dependency change, CI could remain green while installation through Nix is broken.

Could we add nix build .#clawscli after the Nix setup in the Integration Test workflow and, if practical, also run the generated claws --version as a smoke test?

I also left an inline comment about limiting the package output to the claws binary.

For the skipped tests, it would be better in the long term to make them runnable in the Nix environment. However, that can be handled as a follow-up, and I do not think the current skip list needs to block this PR.

Comment thread flake.nix
in
{
packages = {
clawscli = pkgs.buildGoModule (fa: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, buildGoModule includes both claws and scripts/gen-imports in the package output. This means that nix profile add also adds the development-only gen-imports command to the user's PATH.

Could we limit the build target to cmd/claws using subPackages, so that the package only exposes the claws binary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants