build: add a nix flake#233
Conversation
Provides buildGoModule derivation for both dstask and dstask-import, with proper ldflags for version info. Includes a dev shell with go and golangci-lint. Closes naggie#209
Delegates to the flake's devShell so both `nix-shell` and `nix develop` use the same environment.
Runs `nix build` and `nix flake check` on every push/PR. A stale vendorHash causes a hash mismatch error, so dependency changes that forget to update the hash will fail CI.
The commit hash already identifies the build. The date added complexity (reformatting self.lastModifiedDate) for little value, especially since Nix builds prioritize reproducibility. Only print the 'Build date' line when a real value is injected (e.g. by goreleaser). Plain `go build` and Nix builds leave it as the default 'Unknown', which is just noise.
|
As requested in #209 (comment). I won't have time to iterate on this over the next couple of weeks. So feel free to take over @eduardofuncao. |
| ## Nix Flake | ||
|
|
||
| Run directly without installing: | ||
|
|
||
| ```sh | ||
| nix run github:naggie/dstask -- version | ||
| ``` | ||
|
|
||
| Install into your profile: | ||
|
|
||
| ```sh | ||
| nix profile install github:naggie/dstask | ||
| ``` | ||
|
|
||
| Dev shell (Go + golangci-lint): | ||
|
|
||
| ```sh | ||
| nix develop # with flakes | ||
| nix-shell # legacy, uses flake-compat shim | ||
| ``` | ||
|
|
There was a problem hiding this comment.
A minor suggestion, but I would add this inside a <details> block, like this:
Nix Flake
Run directly without installing:nix run github:naggie/dstask -- versionInstall into your profile:
nix profile install github:naggie/dstaskDev shell (Go + golangci-lint):
nix develop # with flakes
nix-shell # legacy, uses flake-compat shimThere was a problem hiding this comment.
We could consider removing shell.nix altogether
@niklaas Thanks for opening the PR! Unfortunately I can't push to your fork :( is it ok if I open another PR? The changes would be just a minor update on the readme, and dropping the shell.nix and the flake-compat dependency |
Sure thing, take it on! :) |
Closes #209