feat: add Nix flake with home-manager module for declarative builds#637
Open
helgeu wants to merge 4 commits intortk-ai:developfrom
Open
feat: add Nix flake with home-manager module for declarative builds#637helgeu wants to merge 4 commits intortk-ai:developfrom
helgeu wants to merge 4 commits intortk-ai:developfrom
Conversation
helgeu
added a commit
to helgeu/setup
that referenced
this pull request
Mar 16, 2026
Add rtk as a flake input from fork (helgeu/rtk#feat/nix-flake) and include it in claude.nix alongside claude-code. RTK compresses verbose CLI output before it enters an AI agent's context window. Upstream PR: rtk-ai/rtk#637 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Please retarget this PR to |
Author
|
Sorry about that! Retargeted to |
Add a Nix flake with a rustPlatform.buildRustPackage derivation and an overlay for easy integration into other Nix configurations. The package version is read from Cargo.toml so it stays in sync automatically. Update installation docs (README, INSTALL.md, and all translated READMEs) with Nix instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Separate config generation from filesystem writing in `rtk init`. New `--dry-run --json` mode outputs a file manifest (paths, content, permissions) to stdout without touching disk, enabling Nix, Ansible, and other declarative tools to consume RTK's config as build-time data. New flags: --dry-run Output manifest instead of writing files --json JSON format (requires --dry-run) --base-claude-md PATH Seed CLAUDE.md from file (requires --dry-run) --base-settings PATH Seed settings.json from file (requires --dry-run) Also adds lib.mkConfig to flake.nix — a Nix helper that calls rtk init --dry-run --json and deploys the resulting files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Export a proper home-manager module instead of a plain helper function.
Consumers now import rtk.homeManagerModules.default and set:
programs.rtk = {
enable = true;
claudeCode.enable = true;
claudeCode.baseClaude = ./CLAUDE.md.template;
claudeCode.baseSettings = ./settings.json;
};
The module handles package installation and home.file wiring internally.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jq -r appends a trailing newline to output, making the hook file 1 byte larger than what rtk verify expects. This causes the integrity check to fail with a hash mismatch. jq -j outputs raw strings without adding a trailing newline, preserving the exact content. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
flake.nix+nix/package.nix) that builds rtk usingrustPlatform.buildRustPackage--dry-run --jsonflag tortk initfor declarative config managers (outputs file manifest as JSON)nix/homeManagerModule.nix) for declarative Claude Code hook integrationCargo.tomlat eval time — no manual version bumps neededoverlays.default) andhomeManagerModules.defaultfor Nix consumersWhat this enables
Design decisions
builtins.fromTOMLfor version: readsCargo.tomlat eval time so the package version stays in sync with releases automatically--dry-run --json: outputs the full file manifest as JSON so Nix (or any declarative tool) can extract files at build time without side effectsjq -jin module: usesjq -j(notjq -r) to extract file content without adding a trailing newline, preserving exact content forrtk verifyintegrity checksdoCheck = false: tests require network access which is unavailable in the Nix sandboxTest plan
nix buildsucceeds on macOS (aarch64)rtk verifypasses afterdarwin-rebuild switchwith home-manager modulertk gainand hook rewriting work end-to-endnix buildsucceeds on Linux (x86_64)🤖 Generated with Claude Code