[PR #450] [MERGED] Add Nix flake packaging with modules and documentation #481

Closed
opened 2026-03-02 04:13:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/git-ai-project/git-ai/pull/450
Author: @jwiegley
Created: 2/3/2026
Status: Merged
Merged: 2/7/2026
Merged by: @svarlamov

Base: mainHead: nix-support


📝 Commits (10+)

  • 3e68eff Add include_prompts_in_repositories whitelist for prompt storage
  • e239323 Skip symlink creation when running from Nix store
  • d250279 Add Nix flake for building, packaging, and deployment
  • 6dd6372 Add Nix installation documentation
  • 1dbc3e4 Unset DEVELOPER_DIR in devShell to fix SDK conflict
  • df75a10 Update src/config.rs
  • ce95867 fix tests
  • f3b899a Update flake.nix
  • 0eadc21 Update flake.nix
  • c8b20e6 Update README-nix.md

📊 Changes

8 files changed (+1507 additions, -40 deletions)

View changed files

.format (+0 -0)
README-nix.md (+235 -0)
flake.lock (+82 -0)
flake.nix (+739 -0)
📝 src/authorship/post_commit.rs (+23 -29)
📝 src/commands/config.rs (+73 -1)
📝 src/config.rs (+348 -10)
📝 src/mdm/ensure_git_symlinks.rs (+7 -0)

📄 Description

Summary

This PR adds comprehensive Nix flake support for installing and managing git-ai on NixOS, nix-darwin, and Home Manager systems.

Features

Nix Flake (flake.nix)

  • rustPlatform.buildRustPackage build for the git-ai binary
  • Wrapped version with automatic ~/.git-ai/config.json initialization
  • git wrapper script using exec -a git to preserve argv[0] for proper passthrough detection
  • git-og bypass script for direct access to real git
  • Development shell with full Rust toolchain
  • NixOS module with system-wide activation scripts
  • Home Manager module for user-level hooks and config management
  • Nixpkgs overlay for easy importing

Documentation (README-nix.md)

  • Quick start commands for trying and installing git-ai
  • Complete flake outputs reference
  • Installation methods: Home Manager (recommended), nix-darwin, NixOS system-wide, direct package, overlay
  • Module options tables for both NixOS and Home Manager modules
  • Development shell instructions

Bug Fixes

argv[0] preservation for git passthrough

  • When git-ai is invoked as git, it checks argv[0] to determine whether to pass through to real git or handle git-ai commands
  • The Nix wrapper now uses exec -a git to explicitly set argv[0], ensuring proper passthrough behavior
  • Without this fix, git status would incorrectly show "Unknown git-ai command: status"

Extension detection without CLI in PATH

  • During Home Manager/nix-darwin activation, PATH doesn't include directories like /opt/homebrew/bin where editor CLIs live
  • Extension detection now checks ~/.cursor/extensions/ and ~/.vscode/extensions/ directories directly
  • This eliminates false warnings when extensions are already installed but the CLI isn't in PATH

Screenshot

This is what it looks like when I switch to my new system configuration with git-ai hooked in:

image
Open with Devin

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/git-ai-project/git-ai/pull/450 **Author:** [@jwiegley](https://github.com/jwiegley) **Created:** 2/3/2026 **Status:** ✅ Merged **Merged:** 2/7/2026 **Merged by:** [@svarlamov](https://github.com/svarlamov) **Base:** `main` ← **Head:** `nix-support` --- ### 📝 Commits (10+) - [`3e68eff`](https://github.com/git-ai-project/git-ai/commit/3e68eff73942871d58e57083aad7c11977dda6bc) Add include_prompts_in_repositories whitelist for prompt storage - [`e239323`](https://github.com/git-ai-project/git-ai/commit/e239323f0538a6f5953065fc2062ce4b09854a43) Skip symlink creation when running from Nix store - [`d250279`](https://github.com/git-ai-project/git-ai/commit/d2502795703f6be9360fea600a96f4138f0c8037) Add Nix flake for building, packaging, and deployment - [`6dd6372`](https://github.com/git-ai-project/git-ai/commit/6dd63727ca73d4d3a3efee6f3de830f025e87015) Add Nix installation documentation - [`1dbc3e4`](https://github.com/git-ai-project/git-ai/commit/1dbc3e4ffb377525cecda384a2234b1647013630) Unset DEVELOPER_DIR in devShell to fix SDK conflict - [`df75a10`](https://github.com/git-ai-project/git-ai/commit/df75a109a7de6c37ade01682521cf620c50b2667) Update src/config.rs - [`ce95867`](https://github.com/git-ai-project/git-ai/commit/ce95867cf182270de6beeea1e6cb893ff47e9702) fix tests - [`f3b899a`](https://github.com/git-ai-project/git-ai/commit/f3b899aaf3eac3458dd6bff7497733a3c7e1bc45) Update flake.nix - [`0eadc21`](https://github.com/git-ai-project/git-ai/commit/0eadc21329dcb7d55beb033fd0d2bf21984db1bf) Update flake.nix - [`c8b20e6`](https://github.com/git-ai-project/git-ai/commit/c8b20e6151bee0c7f36ae37c1b9b632d6ff2b0f4) Update README-nix.md ### 📊 Changes **8 files changed** (+1507 additions, -40 deletions) <details> <summary>View changed files</summary> ➕ `.format` (+0 -0) ➕ `README-nix.md` (+235 -0) ➕ `flake.lock` (+82 -0) ➕ `flake.nix` (+739 -0) 📝 `src/authorship/post_commit.rs` (+23 -29) 📝 `src/commands/config.rs` (+73 -1) 📝 `src/config.rs` (+348 -10) 📝 `src/mdm/ensure_git_symlinks.rs` (+7 -0) </details> ### 📄 Description ## Summary This PR adds comprehensive Nix flake support for installing and managing git-ai on NixOS, nix-darwin, and Home Manager systems. ### Features **Nix Flake (`flake.nix`)** - `rustPlatform.buildRustPackage` build for the git-ai binary - Wrapped version with automatic `~/.git-ai/config.json` initialization - `git` wrapper script using `exec -a git` to preserve argv[0] for proper passthrough detection - `git-og` bypass script for direct access to real git - Development shell with full Rust toolchain - NixOS module with system-wide activation scripts - Home Manager module for user-level hooks and config management - Nixpkgs overlay for easy importing **Documentation (`README-nix.md`)** - Quick start commands for trying and installing git-ai - Complete flake outputs reference - Installation methods: Home Manager (recommended), nix-darwin, NixOS system-wide, direct package, overlay - Module options tables for both NixOS and Home Manager modules - Development shell instructions ### Bug Fixes **argv[0] preservation for git passthrough** - When git-ai is invoked as `git`, it checks argv[0] to determine whether to pass through to real git or handle git-ai commands - The Nix wrapper now uses `exec -a git` to explicitly set argv[0], ensuring proper passthrough behavior - Without this fix, `git status` would incorrectly show "Unknown git-ai command: status" **Extension detection without CLI in PATH** - During Home Manager/nix-darwin activation, PATH doesn't include directories like `/opt/homebrew/bin` where editor CLIs live - Extension detection now checks `~/.cursor/extensions/` and `~/.vscode/extensions/` directories directly - This eliminates false warnings when extensions are already installed but the CLI isn't in PATH ### Screenshot This is what it looks like when I switch to my new system configuration with `git-ai` hooked in: <img width="648" height="534" alt="image" src="https://github.com/user-attachments/assets/018bcbcc-96c9-47eb-8c8d-26a74b4962ca" /> <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/git-ai-project/git-ai/pull/450" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 04:13:45 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#481
No description provided.