-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add nix flake support (sorry for this duplicate) #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe PR introduces Nix flake support for OpenSpec, adding a root-level Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review CompleteYour review story is ready! Comment !reviewfast on this PR to re-generate the story. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.gitignore (1)
149-151: Consider movingresultunder a Nix-specific section.The
resultsymlink is created bynix build, not pnpm. Adding a dedicated Nix section improves clarity for contributors unfamiliar with the tooling.Suggested organization
# Pnpm .pnpm-store/ -result + +# Nix +result +.direnv/flake.nix (1)
20-24: Consider filtering source to exclude unnecessary files.Using
src = ./.;copies the entire repository including.git, docs, and other files not needed for the build. Consider usingcleanSourceor a custom filter.Example with cleanSource
- src = ./.; + src = pkgs.lib.cleanSource ./.;Or for more control:
src = pkgs.lib.cleanSourceWith { src = ./.; filter = path: type: let baseName = baseNameOf path; in !(baseName == ".git" || baseName == "openspec" || baseName == "assets"); };README.md (1)
138-149: Consider using proper headings instead of bold text.The static analysis tool flags
**Option A:**and**Option B:**as emphasis used instead of headings (MD036). Using##### Option A: Using npmwould be more semantically correct and improve document structure.Suggested fix
-**Option A: Using npm** +##### Option A: Using npm-**Option B: Using Nix (NixOS and Nix package manager)** +##### Option B: Using Nix (NixOS and Nix package manager)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
flake.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
.gitignoreREADME.mdflake.nixopenspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yamlopenspec/changes/archive/2026-01-07-add-nix-flake-support/design.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
🧰 Additional context used
📓 Path-based instructions (2)
openspec/changes/**/*.md
📄 CodeRabbit inference engine (openspec/AGENTS.md)
Scaffold proposal using
proposal.md,tasks.md, optionaldesign.md, and delta specs underopenspec/changes/<id>/
Files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/design.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
openspec/changes/**/specs/**/spec.md
📄 CodeRabbit inference engine (openspec/AGENTS.md)
openspec/changes/**/specs/**/spec.md: Use## ADDED|MODIFIED|REMOVED|RENAMED Requirementsheaders in spec delta files
Include at least one#### Scenario:per requirement in spec delta files
Use#### Scenario: Nameformat (4 hashtags) for scenario headers, not bullets or bold text
Use## ADDED Requirementsfor new orthogonal capabilities that can stand alone; use## MODIFIED Requirementsfor behavior changes of existing requirements
When using MODIFIED Requirements, paste the full requirement block including header and all scenarios
Files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.md
🧠 Learnings (12)
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/*.md : Scaffold proposal using `proposal.md`, `tasks.md`, optional `design.md`, and delta specs under `openspec/changes/<id>/`
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yamlopenspec/changes/archive/2026-01-07-add-nix-flake-support/design.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.mdREADME.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements` headers in spec delta files
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yamlREADME.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Use `## ADDED Requirements` for new orthogonal capabilities that can stand alone; use `## MODIFIED Requirements` for behavior changes of existing requirements
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdREADME.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/*/proposal.md : Ensure `proposal.md` includes sections: Why (1-2 sentences), What Changes (bullet list with breaking change markers), and Impact (affected specs and code)
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/design.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.mdREADME.md
📚 Learning: 2025-11-25T01:08:02.839Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:02.839Z
Learning: Use `@/openspec/AGENTS.md` to learn how to create and apply change proposals, spec format and conventions, and project structure and guidelines
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdREADME.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Include at least one `#### Scenario:` per requirement in spec delta files
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Check `openspec/project.md` for project conventions before creating specs
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yamlopenspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.mdREADME.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : When using MODIFIED Requirements, paste the full requirement block including header and all scenarios
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/specs/**/spec.md : Use SHALL/MUST for normative requirements in spec files; avoid should/may unless intentionally non-normative
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yamlREADME.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Create `design.md` only when needed: cross-cutting changes, new external dependencies, significant data model changes, security/performance complexity, or pre-coding ambiguity
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/design.mdopenspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.mdREADME.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/*/tasks.md : Ensure `tasks.md` contains implementation checklist with numbered sections and checkbox items
Applied to files:
openspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
🪛 LanguageTool
openspec/changes/archive/2026-01-07-add-nix-flake-support/design.md
[style] ~77-~77: ‘lag behind’ might be wordy. Consider a shorter alternative.
Context: ...rrect hash [Risk] Nix builds might lag behind npm releases → Mitigation: This is ...
(EN_WORDINESS_PREMIUM_LAG_BEHIND)
openspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.md
[uncategorized] ~3-~3: The official name of this software platform is spelled with a capital “H”.
Context: ...he Nix ecosystem, enabling users to run nix run github:Fission-AI/OpenSpec -- init or include...
(GITHUB)
openspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
[uncategorized] ~60-~60: The official name of this software platform is spelled with a capital “H”.
Context: ...st on macOS if available - [ ] 9.5 Test nix run github:Fission-AI/OpenSpec -- init after merg...
(GITHUB)
🪛 markdownlint-cli2 (0.18.1)
README.md
138-138: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
149-149: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (8)
openspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yaml (1)
1-2: LGTM!The metadata file correctly identifies this as a spec-driven change with the appropriate creation date.
openspec/changes/archive/2026-01-07-add-nix-flake-support/design.md (1)
1-94: Well-structured design document.The document comprehensively covers the rationale for technical decisions, including the choice of
stdenv.mkDerivationoverbuildNpmPackage, thegenAttrspattern for multi-platform support, and proper hash management workflow. This provides valuable context for future maintainers.openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.md (1)
1-79: Spec follows OpenSpec conventions correctly.The document properly uses
## ADDED Requirementsfor new capabilities, includes scenarios for each requirement using the#### Scenario:format, and employs normative language (SHALL/MUST) throughout. As per coding guidelines, this is well-structured.flake.nix (2)
67-85: LGTM!The devShell provides a good developer experience with clear version output and guidance to run
pnpm install. This matches the spec requirement for the development shell.
21-22: The hardcoded version in flake.nix is currently synchronized with package.json (both at 0.18.0). While this is a known maintenance consideration, the versions are in sync. If you adopt this pattern, consider documenting in your release process that both files must be updated together to prevent future drift.openspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.md (1)
1-25: Proposal follows OpenSpec conventions.The document includes all required sections: Why (concise motivation), What Changes (bullet list), Capabilities (new/modified), and Impact (files, docs, CI, maintenance). This provides clear context for the change.
README.md (1)
161-175: Helpful flake integration example.The example demonstrates how to add OpenSpec to an existing development environment, which is valuable for Nix users who want declarative tooling.
openspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md (1)
1-65: Well-structured implementation checklist following OpenSpec conventions.This tasks.md file properly scaffolds the Nix flake support feature with a comprehensive 10-section implementation plan covering flake structure, package configuration, build and installation phases, metadata, app entry points, development environments, dependency management, testing, and documentation. The 28 completed items reflect solid progress, and the 2 pending items (macOS testing and post-merge validation) are appropriately tracked and align with the PR's stated testing status. The checkbox structure with clear, actionable subtasks makes implementation progress transparent and verifiable.
|
@mipmip Could you maybe educate me a bit more on Nix? Is this for users or contributors? Why this over docker for example? I feel like I'd need to understand this more if I am to accept this since I'll also have to maintain it going forward. |
|
@mipmip Thank you for trying out the new experimental workflow btw, would love your thoughts on the experience |
Primary this flake is meant for Nix-users but contributing becomes more easy as well. By adding this flake.nix OpenSpec becomes available to all Nix users. I can already run OpenSpec (or install it) with my forked version by running If you want to increase your userbase, allowing this flake helps for sure. Besides above elevator pitch I would encourage you to learn more about Nix as it is a mindblowing technology which is alsmost as addictive as Vibe coding. https://www.youtube.com/results?search_query=nix+nixos&sp=CAM%253D |
I like the concept of OpenSpec a lot and I know for sure I'm going to integrate this in my workflows. Fun fact... this PR is the first real experience I've had with OpenSpec :) I cheated a bit though. I first created the flake.nix to be able to run it. Afterwards I used it together with claude to create the change and spec files. It was a great experience ! |
| { | ||
| default = pkgs.stdenv.mkDerivation (finalAttrs: { | ||
| pname = "openspec"; | ||
| version = "0.18.0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there's a hardcoded version here? Do we have a way to make this dynamic?
In general what I'm trying to figure out is how does this fit into the standard release process, do we need to add any CI/CD for this that works alongside the standard release process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think package.json could be imported in the flake. Will have a look for this tomorrow (dutch time). I can also create a nix build script in the github actions to prove it's working correctly.
Add Nix Flake Support
Adds a
flake.nixto enable OpenSpec installation and usage via the Nix package manager.Changes
Benefits
Users can now:
nix run github:Fission-AI/OpenSpec -- initnix profile install github:Fission-AI/OpenSpecImplementation
This change followed the OpenSpec spec-driven workflow. Full documentation including proposal, specs, design decisions, and tasks is available at:
openspec/changes/archive/2026-01-07-add-nix-flake-support/Testing
nix buildsucceeds on x86_64-linuxnix run . -- --versionworksnix developprovides correct environmentnix run github:Fission-AI/OpenSpec) testable after mergeTechnical Details
stdenv.mkDerivationwith pnpm hooks (following nixpkgs patterns)fetcherVersion = 3sha256-ltG+wmr2aiRmghEMGOZVYifvrY8qdLDfizLq6a8Ds0s=Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.