Add Nix flake + nix flake check CI - #1
Merged
Merged
Conversation
schickling-assistant
force-pushed
the
add-nix-flake-and-ci
branch
from
July 25, 2026 13:17
d01706f to
2d5e3ba
Compare
schickling
marked this pull request as ready for review
July 25, 2026 13:59
Contributor
`st2 --version` follows the shared build-versioning contract instead of a bare `semver (sha)`: a stable machineVersion (`0.1.0+<rev>[-dirty]`) and a human displayVersion, from a `CLI_BUILD_STAMP` JSON stamp (same env var + shape as the fleet's TS/otel-scrape readers) via `option_env!`. The flake bakes an authoritative NixStamp from `self` (no `.git` needed); `build.rs` bakes a LocalStamp from git for `cargo build` in a separate var so it never overrides the Nix stamp. Shell completions: `st2 completions <bash|zsh|fish|…>` via clap_complete, generated from the live command tree so they never drift from the flags. No git deps added, so cargoLock stays hash-free. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Package st2 with rustPlatform.buildRustPackage (cargoLock.lockFile — no git deps, so no per-dep hashes to maintain). `nix flake check` builds the binary, runs the hermetic unit tests (`--lib --bins`), installs shell completions, and smoke-tests `st2 --help` + the completions. The integration tests in tests/*.rs assume a real environment the Nix sandbox lacks (/bin/bash+jq, /usr/bin/git on a hardcoded PATH, live pty/convoy/systemd), so they run on native CI rather than here. fmt/clippy are intentionally not gated — a repo-wide format/lint gate would fight the maintainer's own commits; the devShell ships rustfmt + clippy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
schickling-assistant
force-pushed
the
add-nix-flake-and-ci
branch
from
July 26, 2026 08:28
933b1ee to
3bcc82d
Compare
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bcc82d3d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a self-contained Nix flake +
nix flake checkCI, plus build-identity and shell completions. Rebased onto currentmain.Kept intentionally lean — this is packaging, and it shouldn't fight your active development:
What's here (2 commits)
feat: build identity + shell completionsst2 --versionfollows the shared build-versioning contract: a stablemachineVersion(0.1.0+<rev>[-dirty]) + a humandisplayVersion, from aCLI_BUILD_STAMPJSON stamp read viaoption_env!. The flake bakes an authoritative NixStamp fromself(so a hermetic build knows its rev with no.git);build.rsbakes a LocalStamp from git forcargo buildinto a separate var, so it can never override the Nix stamp.st2 completions <bash|zsh|fish|…>viaclap_complete, generated from the live command tree (never drifts from the flags). No git deps added →cargoLockstays hash-free.ci: add self-contained Nix flake + nix flake checkrustPlatform.buildRustPackage+cargoLock.lockFile.nix flake checkbuilds the binary, runs the hermetic unit tests (--lib --bins, ~150), installs the completions, and smoke-tests--help+ completions.Two deliberate choices (so it doesn't fight you)
tests/*.rsintegration tests each assume a real environment the Nix build sandbox lacks —/bin/bash+jq(the shipped Codex hooks),/usr/bin/giton a hardcodedPATH(materialize's git-worktree check), a livepty/convoy/systemd---usermanager (the survival + render-neutrality gates). Chasing those with per-test skips is unbounded as the suite grows, so they run on native CI (a real runner) while the flake proves the package builds + its unit tests pass.cargo fmt/clippygate, no repo-wide reformat. A format/lint gate on your hand-crafted tree would conflict with your own commits on every rebase. The devShell shipsrustfmt+clippyfor whoever wants them.Totally understand if you want to reshape the flake (e.g. toward a function that produces an agent spec) — happy to iterate. This is just a working, rebased-clean baseline.