Skip to content

Conversation

@mipmip
Copy link

@mipmip mipmip commented Jan 7, 2026

Add Nix Flake Support

Adds a flake.nix to enable OpenSpec installation and usage via the Nix package manager.

Changes

  • flake.nix: Multi-platform package definition (x86_64/aarch64, Linux/macOS)
  • README.md: Added Nix installation instructions

Benefits

Users can now:

  • Run directly: nix run github:Fission-AI/OpenSpec -- init
  • Install to profile: nix profile install github:Fission-AI/OpenSpec
  • Add to development environments via flake inputs

Implementation

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 build succeeds on x86_64-linux
  • nix run . -- --version works
  • nix develop provides correct environment
  • ⏸️ macOS testing pending (requires platform access)
  • ⏸️ GitHub direct run (nix run github:Fission-AI/OpenSpec) testable after merge

Technical Details

  • Uses stdenv.mkDerivation with pnpm hooks (following nixpkgs patterns)
  • pnpm lockfile v9.0 with fetcherVersion = 3
  • Dependency hash: sha256-ltG+wmr2aiRmghEMGOZVYifvrY8qdLDfizLq6a8Ds0s=

Summary by CodeRabbit

  • New Features

    • Added Nix flake support for installation and development environments across Linux and macOS
  • Documentation

    • Updated installation guide with alternative npm and Nix installation methods
    • Extended initialization instructions with detailed workflow steps and examples
    • Added comprehensive end-to-end usage walkthrough demonstrating the complete workflow

✏️ Tip: You can customize this high-level summary in your review settings.

@mipmip mipmip requested a review from TabishB as a code owner January 7, 2026 15:34
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

The PR introduces Nix flake support for OpenSpec, adding a root-level flake.nix configuration for multi-platform builds across Linux and macOS (x86_64 and aarch64) with pnpm-based dependency management. Documentation is expanded with npm and Nix installation options, detailed initialization workflow, and end-to-end examples. Change tracking files document design decisions, specifications, and implementation tasks for this feature.

Changes

Cohort / File(s) Summary
Build & Infrastructure Configuration
.gitignore, flake.nix
Added result to .gitignore under Pnpm section. New flake.nix declares multi-system Nix flake with pnpm-based package builds, app entry point, and dev shell including nodejs_20 and pnpm_9; supports x86_64/aarch64 on Linux and Darwin.
Installation & Usage Documentation
README.md
Expanded Step 1 with alternative installation methods: npm (global install) and Nix (direct run or profile install). Extended initialization workflow with explicit openspec init commands, describes configuration steps, directory creation, and verification. Added end-to-end example of creating and archiving a change with generated file structure.
Change Tracking & Specifications
openspec/changes/archive/2026-01-07-add-nix-flake-support/*
New change record including: .openspec.yaml (metadata), proposal.md (feature summary), design.md (implementation decisions), specs/nix-flake-support/spec.md (acceptance criteria), and tasks.md (10-step implementation checklist with build configuration, dependency hashing, app setup, dev shell, testing, and documentation).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • TabishB

Poem

🐰 With flake.nix in hand, we hop with glee,
Multi-platform builds for Linux and macOS free!
Nix runs our specs from sea to shining sea,
Documentation blooms, the workflow's clear to see,
OpenSpec now builds on every architecture spree! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: add nix flake support' directly and clearly describes the main change—adding Nix flake support to the repository. The parenthetical note about duplication does not detract from the core message.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vibe-kanban-cloud
Copy link

Review Complete

Your review story is ready!

View Story

Comment !reviewfast on this PR to re-generate the story.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 moving result under a Nix-specific section.

The result symlink is created by nix 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 using cleanSource or 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 npm would 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

📥 Commits

Reviewing files that changed from the base of the PR and between 533cb0f and 09d39d6.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • .gitignore
  • README.md
  • flake.nix
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yaml
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/design.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.md
  • openspec/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, optional design.md, and delta specs under openspec/changes/<id>/

Files:

  • openspec/changes/archive/2026-01-07-add-nix-flake-support/specs/nix-flake-support/spec.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/design.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.md
  • openspec/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 Requirements headers in spec delta files
Include at least one #### Scenario: per requirement in spec delta files
Use #### Scenario: Name format (4 hashtags) for scenario headers, not bullets or bold text
Use ## ADDED Requirements for new orthogonal capabilities that can stand alone; use ## MODIFIED Requirements for 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.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yaml
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/design.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
  • README.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.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yaml
  • README.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.md
  • README.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.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/design.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/proposal.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
  • README.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.md
  • README.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.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/.openspec.yaml
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
  • README.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.yaml
  • README.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.md
  • openspec/changes/archive/2026-01-07-add-nix-flake-support/tasks.md
  • README.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.mkDerivation over buildNpmPackage, the genAttrs pattern 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 Requirements for 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.

@TabishB
Copy link
Contributor

TabishB commented Jan 7, 2026

@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.

@TabishB
Copy link
Contributor

TabishB commented Jan 7, 2026

@mipmip Thank you for trying out the new experimental workflow btw, would love your thoughts on the experience

@mipmip
Copy link
Author

mipmip commented Jan 7, 2026

@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.

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 nix run github:mipmip/openspec -- init. But I can also execute nix develop and start developing. The reason I made this flake is that openspec is still missing in the official nixpkgs-package library. This is the largest package library of all linux distributions and the Nix community is very large itself. I know for sure this flake helps getting OpenSpec in the nixpkgs library faster.

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

@mipmip
Copy link
Author

mipmip commented Jan 7, 2026

@mipmip Thank you for trying out the new experimental workflow btw, would love your thoughts on the experience

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";
Copy link
Contributor

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?

Copy link
Author

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.

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.

2 participants