Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Dec 16, 2025

Summary

Migrate the repository to use Nix for development environment and CI workflows, following the patterns from stackone-ai-node repository.

Changes

CI/CD

  • Add .github/actions/setup-nix for reusable Nix setup action
  • Create unified ci.yml workflow (replaces test.yml and lint.yml)
  • Add nix-flake.yml for flake validation
  • Update docs.yml and release.yml to use Nix
  • All workflows now use Nix for reproducible builds with Cachix caching

Development Environment

  • Add flake.nix with development shell configuration
  • Configure git-hooks.nix for automatic git hook management
  • Configure treefmt with ruff (check + format) and nixfmt
  • Pre-commit hooks: treefmt + mypy (auto-installed in nix develop)
  • Remove Python-based pre-commit in favor of Nix-native git-hooks.nix
  • Update .gitignore to exclude Nix-managed .pre-commit-config.yaml

Documentation

  • Add Nix installation section to README as recommended development setup
  • Update CLAUDE.md with Nix-related development information

Benefits

  • Reproducible Builds: Consistent environment across local dev and CI
  • Faster CI: Cachix integration speeds up builds
  • Automatic Setup: nix develop auto-installs dependencies and git hooks
  • Unified Workflows: Single CI workflow instead of separate test/lint
  • Better DX: Single command (nix fmt) for all formatting
  • Cross-platform: Works identically on Linux, macOS, and NixOS

Test Plan

  • nix flake check passes
  • nix develop enters shell and installs git hooks
  • nix fmt formats code correctly
  • Git hooks run on commit (treefmt + mypy)
  • CI workflows validate on push
  • All existing tests pass

Breaking Changes

None. The repository still works with traditional pip/uv installation. Nix is optional but recommended for development.


Summary by cubic

Migrates development and CI to Nix for reproducible environments and faster builds, unifying lint, type-check, and tests under a single workflow. Pre-commit is replaced with Nix-native git hooks and treefmt for simpler setup.

  • Refactors

    • Added flake.nix dev shell with uv, just, nixfmt, and a shellHook to auto-install dependencies and git hooks; added .envrc for direnv flake support.
    • Introduced reusable .github/actions/setup-nix with Cachix caching.
    • Replaced test.yml and lint.yml with a unified ci.yml (Python 3.9, 3.10, 3.13).
    • Added nix-flake.yml to validate flake configurations.
    • Updated docs.yml and release.yml to run in Nix.
    • Removed Python-based pre-commit; hooks managed by git-hooks.nix; formatting via treefmt (ruff + nixfmt + prettier). Flake check skips pre-commit; mypy runs in nix develop and CI.
  • Migration

    • Optional: install Nix (with flakes) and run nix develop to auto-install deps and hooks.
    • Use nix fmt for formatting and nix flake check for validation.
    • Stop using pre-commit; hooks are now managed by git-hooks.nix.
    • pip/uv workflows still work; no breaking changes.

Written for commit 56e9314. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings December 16, 2025 17:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the repository from traditional Python tooling to a Nix-based development environment and CI workflow setup, providing reproducible builds and unified tooling across development and continuous integration.

Key Changes:

  • Replaces separate test.yml and lint.yml workflows with a unified ci.yml workflow using Nix
  • Introduces flake.nix for development environment configuration with automatic dependency installation and git hooks
  • Removes Python-based pre-commit configuration in favor of Nix-native git-hooks.nix with treefmt

Reviewed changes

Copilot reviewed 16 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
flake.nix Adds Nix flake configuration defining the development environment, treefmt settings, and git hooks
.github/workflows/ci.yml New unified CI workflow using Nix for lint, type-check, and test jobs
.github/workflows/nix-flake.yml Adds workflow to validate Nix flake syntax and structure
.github/actions/setup-nix/action.yaml Reusable composite action for setting up Nix with Cachix caching
.github/workflows/release.yml Updates release workflow to use Nix for building and publishing
.github/workflows/docs.yml Updates documentation workflow to use Nix for building docs
.github/workflows/test.yml Removed in favor of unified ci.yml workflow
.github/workflows/lint.yml Removed in favor of unified ci.yml workflow
.pre-commit-config.yaml Removed Python pre-commit configuration (replaced by git-hooks.nix)
pyproject.toml Removes pre-commit dependency from dev dependencies
Makefile Removes pre-commit install step from install target
README.md Adds Nix installation instructions as recommended development setup
.envrc Adds direnv configuration for automatic Nix environment loading
stackone_ai/meta_tools.py Code formatting change (line length)
stackone_ai/feedback/tool.py Code formatting changes (line length and trailing commas)
examples/test_examples.py Code formatting changes (trailing commas)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ryoppippi ryoppippi force-pushed the fix-flake branch 3 times, most recently from f5ebcfd to 36fc480 Compare December 16, 2025 17:30
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 19 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="flake.nix">

<violation number="1" location="flake.nix:22">
P2: Missing `x86_64-darwin` in systems list. Intel Mac users won&#39;t be able to use this flake. Consider adding `&quot;x86_64-darwin&quot;` to maintain cross-platform support as described in the PR.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@ryoppippi ryoppippi changed the title chore: migrate to Nix-based development and CI workflows chore: migrate to Nix-based development and CI workflows [ENG-11657] Dec 16, 2025
Migrate all CI workflows to use Nix for consistent, reproducible builds
following the pattern from stackone-ai-node repository.

Changes:
- Add .github/actions/setup-nix for reusable Nix setup
- Create unified ci.yml workflow (replaces test.yml and lint.yml)
- Add nix-flake.yml for flake validation
- Update docs.yml and release.yml to use Nix
- Enhance flake.nix shellHook to auto-install dependencies
- Remove separate test.yml and lint.yml workflows

Benefits:
- Consistent environment between local dev and CI
- Faster builds with Cachix caching
- Single unified CI workflow
- Automatic dependency installation via shellHook
Replace pre-commit with Nix-native git-hooks.nix and treefmt for better
integration with the Nix development environment.

Changes:
- Add git-hooks.nix and treefmt-nix flake inputs
- Configure treefmt with ruff (check + format) and nixfmt
- Set up git-hooks with treefmt and mypy pre-commit hooks
- Remove .pre-commit-config.yaml
- Remove pre-commit from dev dependencies
- Update Makefile to remove pre-commit install step
- Format code with treefmt (ruff)

Benefits:
- Consistent formatting via `nix fmt`
- Automatic git hook installation in nix develop
- No Python-based pre-commit dependency
- Faster hook execution
- Better Nix ecosystem integration
Add Nix as the recommended development setup with instructions for
entering the dev environment, formatting, and running checks.

Benefits of using Nix:
- Automatic dependency installation
- Git hooks auto-configured
- Consistent environment across platforms
This file is auto-generated by git-hooks.nix and should not be tracked.
Configure git-hooks to skip the check during 'nix flake check' because
mypy requires the Python environment which isn't available in the Nix
sandbox.

The mypy hook still works locally in 'nix develop' where the Python
environment is available. Mypy is also run in CI via ci.yml.

Changes:
- Set pre-commit.check.enable = false to skip flake check
- Keep mypy hook enabled for local development
- Treefmt check still runs in flake check
Replace Makefile with justfile for better command runner experience.
Add just to Nix devShell for development environment.
Apply consistent formatting across the repository using nix fmt:
- YAML files: standardise string quoting to double quotes
- Markdown files: add blank lines before lists for proper rendering
- Remove trailing whitespace in CLAUDE.md
Copy link

@StuBehan StuBehan left a comment

Choose a reason for hiding this comment

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

LGTM

@ryoppippi ryoppippi merged commit ad8fce4 into main Dec 18, 2025
8 checks passed
@ryoppippi ryoppippi deleted the fix-flake branch December 18, 2025 12:13
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.

3 participants