Skip to content

feat: Add Nix flake support for building and distributing seam-cli - #633

Merged
razor-x merged 8 commits into
mainfrom
claude/nix-nixos-support-ec1bph
Aug 20, 2026
Merged

feat: Add Nix flake support for building and distributing seam-cli#633
razor-x merged 8 commits into
mainfrom
claude/nix-nixos-support-ec1bph

Conversation

@razor-x

@razor-x razor-x commented Aug 20, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds Nix flake support to the seam-cli project, enabling users to build, run, and install the CLI using Nix package manager.

Key Changes

  • Added flake.nix: Defines a Nix flake with outputs for building seam-cli across multiple platforms (x86_64-linux, aarch64-linux, aarch64-darwin)
  • Added flake.lock: Locks nixpkgs dependency to ensure reproducible builds
  • Added package.nix: Implements the Nix package definition using buildNpmPackage, which:
    • Compiles the CLI into a standalone Bun executable via the new build:standalone npm script
    • Installs the binary to $out/bin
    • Disables stripping and ELF patching to preserve the Bun runtime + JavaScript bundle format
  • Added build:standalone npm script: Uses Bun to compile src/bin/cli.ts into a single-file executable
  • Updated README.md: Added Nix installation instructions for both running (nix run) and installing (nix profile install) the CLI
  • Updated .gitignore: Added entries for the standalone seam binary and Nix build artifacts (result, result-*)

Implementation Details

The Nix package leverages Bun's native compilation capabilities to create a self-contained executable. Special care is taken to preserve the executable's integrity by disabling standard post-build transformations (stripping and ELF patching) that would corrupt the appended JavaScript bundle.

https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1

claude added 8 commits August 20, 2026 17:22
Package the standalone binary with buildNpmPackage and importNpmLock so
npm remains the only dependency lockfile: importNpmLock feeds the existing
package-lock.json to npm offline, and bun compiles src/bin/cli.ts the same
way the release workflow does.

The compile itself moves into a new build:standalone npm script, so the Nix
build runs the project's own build command instead of restating the bun
invocation. Its output is the Bun runtime with the JavaScript bundle
appended, which neither strip nor patchelf can touch without losing the
bundle, so both fixup steps stay off.

Only the compiled executable is installed, so nothing in the closure needs
Node.js. The flake covers every platform Nixpkgs' bun runs on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1
An earlier edit rewrote the file through a text-mode round trip, which
turned the two carriage returns the macOS Icon\r\r entry needs into
newlines and stopped it matching.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1
The attribute, the derivation, and the program it installs now all agree,
and nothing in Nixpkgs claims the name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1
npm chains it the same way the other build scripts here are chained,
instead of an && in the script body.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1
installShellCompletion puts the same loaders that seam completion --install
writes into the profile, so NixOS and Home Manager pick them up without a
second step, and they still resolve to whatever schema the installed binary
carries.

Each installation section in the README now says what it does about
completions, rather than deferring to a note under the last one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1
Only the fixup settings keep one, since nothing about dontStrip and
dontPatchELF says why they are there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1
npm and a manual download need the command. The packages that install
completions themselves do not need to say so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VWSk3QX5mCMRJ6PhsJqC1
@razor-x
razor-x marked this pull request as ready for review August 20, 2026 18:26
@razor-x razor-x changed the title Add Nix flake support for building and distributing seam-cli feat: Add Nix flake support for building and distributing seam-cli Aug 20, 2026
@razor-x
razor-x merged commit c182d4a into main Aug 20, 2026
14 checks passed
@razor-x
razor-x deleted the claude/nix-nixos-support-ec1bph branch August 20, 2026 18:26
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