Add self package to flake.nix, nix fixes, fmt#203
Conversation
* 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.
484acbd to
2313f7b
Compare
yimsk
left a comment
There was a problem hiding this comment.
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.
| in | ||
| { | ||
| packages = { | ||
| clawscli = pkgs.buildGoModule (fa: { |
There was a problem hiding this comment.
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?
default/clawsclipackage that builds this project. Note,vendorHashhas to be set when the dependencies change..goreleaser.ymlselffor automatic version options using the hash of the current git revision. Uses thedirtyShortRevif 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 donix build ...nixfmt.stdenv.targetPlatform.nodevariables for fetching indexion, setmeta.platformsto limit where it can run.