[PR #352] [CLOSED] Add Nix flake packaging with modules and documentation #426

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

📋 Pull Request Information

Original PR: https://github.com/git-ai-project/git-ai/pull/352
Author: @jwiegley
Created: 1/15/2026
Status: Closed

Base: mainHead: main


📄 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

🔄 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/352 **Author:** [@jwiegley](https://github.com/jwiegley) **Created:** 1/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📄 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" /> --- <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:35 +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#426
No description provided.