From 148bb86d0375e745e90933bae0fcb619512a342b Mon Sep 17 00:00:00 2001 From: acevif Date: Fri, 27 Mar 2026 04:09:46 +0900 Subject: [PATCH 1/2] refactor(nix): split dev shell into dedicated flake Move the development shell into nix/devshell while keeping the root package flake on flake-parts. Source agent tooling from llm-agents.nix, add formatter outputs with nixfmt-tree, and update contributor docs for nix develop ./nix/devshell. --- CHANGELOG.md | 1 + CONTRIBUTING.md | 4 +- flake.lock | 23 +--- flake.nix | 32 +----- nix/devshell/flake.lock | 235 ++++++++++++++++++++++++++++++++++++++++ nix/devshell/flake.nix | 51 +++++++++ 6 files changed, 295 insertions(+), 51 deletions(-) create mode 100644 nix/devshell/flake.lock create mode 100644 nix/devshell/flake.nix diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e100ca..ba8d31b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Migrate Nix flake configuration from flake-utils to flake-parts. (#52) - Add autonomy and communication guidance for AI agents. (#42) - Document `nix develop` devShell usage in contributing guide. (#43) +- Split the Nix devShell into `nix/devshell/flake.nix`, keep the root package flake on `flake-parts`, and source coding agents from `llm-agents.nix`. (#52) - Refine one-line descriptions (README, Nix flake metadata, Homebrew formula, and GitHub repository description). (#43) ### Changed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 357f59f..b47c840 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,10 +48,10 @@ We welcome contributions of all kinds and appreciate various types of contributi If you use Nix, you can enter a Rust-ready dev shell: ```sh -nix develop +nix develop ./nix/devshell ``` -This devShell installs `rustup` and `rust-analyzer`, coding agents (`opencode`, `codex`, `claude-code`, `gemini-cli`), and `zsh`, then switches to `zsh`. +This devShell installs `rustup` and `rust-analyzer`, coding agents (`codex`, `claude-code`, `gemini-cli`, `ccusage`, `opencode`) from `llm-agents.nix`, and `zsh`, then switches to `zsh`. ### Building `ignore` diff --git a/flake.lock b/flake.lock index bf25c39..7165ca3 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1769996383, - "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", "type": "github" }, "original": { @@ -36,27 +36,10 @@ "type": "github" } }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1769170682, - "narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c5296fdd05cfa2c187990dd909864da9658df755", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", "systems": "systems" } }, diff --git a/flake.nix b/flake.nix index a6ac902..66ba9bc 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; - nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; @@ -13,8 +12,6 @@ outputs = inputs@{ - nixpkgs, - nixpkgs-unstable, flake-parts, systems, ... @@ -22,13 +19,8 @@ flake-parts.lib.mkFlake { inherit inputs; } { systems = import systems; perSystem = - { system, ... }: + { pkgs, ... }: let - pkgs = import nixpkgs { inherit system; }; - pkgs-unstable = import nixpkgs-unstable { - inherit system; - config.allowUnfree = true; - }; ignorePackage = pkgs.rustPlatform.buildRustPackage { pname = "ignore"; version = "0.4.0"; @@ -51,30 +43,12 @@ }; in { + formatter = pkgs.nixfmt-tree; + packages = { default = ignorePackage; ignore = ignorePackage; }; - - devShells.default = pkgs.mkShell { - packages = - with pkgs; - [ - rustup - rust-analyzer - zsh - opencode - ] - ++ (with pkgs-unstable; [ - codex - claude-code - gemini-cli - ]); - - shellHook = '' - exec zsh - ''; - }; }; }; } diff --git a/nix/devshell/flake.lock b/nix/devshell/flake.lock new file mode 100644 index 0000000..a351d11 --- /dev/null +++ b/nix/devshell/flake.lock @@ -0,0 +1,235 @@ +{ + "nodes": { + "blueprint": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ] + }, + "locked": { + "lastModified": 1771437256, + "narHash": "sha256-bLqwib+rtyBRRVBWhMuBXPCL/OThfokA+j6+uH7jDGU=", + "owner": "numtide", + "repo": "blueprint", + "rev": "06ee7190dc2620ea98af9eb225aa9627b68b0e33", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "bun2nix": { + "inputs": { + "flake-parts": [ + "llm-agents", + "flake-parts" + ], + "import-tree": "import-tree", + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ], + "treefmt-nix": [ + "llm-agents", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1770895533, + "narHash": "sha256-v3QaK9ugy9bN9RXDnjw0i2OifKmz2NnKM82agtqm/UY=", + "owner": "nix-community", + "repo": "bun2nix", + "rev": "c843f477b15f51151f8c6bcc886954699440a6e1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "bun2nix", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "import-tree": { + "locked": { + "lastModified": 1763762820, + "narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=", + "owner": "vic", + "repo": "import-tree", + "rev": "3c23749d8013ec6daa1d7255057590e9ca726646", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "llm-agents": { + "inputs": { + "blueprint": "blueprint", + "bun2nix": "bun2nix", + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs", + "systems": "systems", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1774536390, + "narHash": "sha256-Sv5SKZSHO5j/u15HkhhB0lKr357C36P8hcHAOr6DxJY=", + "owner": "numtide", + "repo": "llm-agents.nix", + "rev": "2a6459a5bf16be85fb8da6cbf10cbd1ec6d3b07b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "llm-agents.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1774273680, + "narHash": "sha256-a++tZ1RQsDb1I0NHrFwdGuRlR5TORvCEUksM459wKUA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fdc7b8f7b30fdbedec91b71ed82f36e1637483ed", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1774244481, + "narHash": "sha256-4XfMXU0DjN83o6HWZoKG9PegCvKvIhNUnRUI19vzTcQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4590696c8693fea477850fe379a01544293ca4e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "llm-agents": "llm-agents", + "nixpkgs": "nixpkgs_2", + "systems": "systems_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773297127, + "narHash": "sha256-6E/yhXP7Oy/NbXtf1ktzmU8SdVqJQ09HC/48ebEGBpk=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "71b125cd05fbfd78cab3e070b73544abe24c5016", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/devshell/flake.nix b/nix/devshell/flake.nix new file mode 100644 index 0000000..8753e46 --- /dev/null +++ b/nix/devshell/flake.nix @@ -0,0 +1,51 @@ +{ + description = "Development shell for ignore"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + llm-agents.url = "github:numtide/llm-agents.nix"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + systems.url = "github:nix-systems/default"; + }; + + outputs = + inputs@{ + flake-parts, + systems, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = import systems; + perSystem = + { pkgs, inputs', ... }: + { + formatter = pkgs.nixfmt-tree; + + devShells.default = pkgs.mkShell { + packages = [ + pkgs.rustup + pkgs.rust-analyzer + pkgs.zsh + inputs'.llm-agents.packages.codex + inputs'.llm-agents.packages.claude-code + inputs'.llm-agents.packages.gemini-cli + inputs'.llm-agents.packages.ccusage + inputs'.llm-agents.packages.opencode + ]; + + shellHook = '' + exec zsh + ''; + }; + }; + }; + + # Use llm-agents.nix's binary cache for prebuilt agent packages. + nixConfig = { + extra-substituters = [ "https://cache.numtide.com" ]; + extra-trusted-public-keys = [ "niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" ]; + }; +} From 4ea70769c067c524e8554116a22f11b874526110 Mon Sep 17 00:00:00 2001 From: acevif Date: Fri, 27 Mar 2026 05:20:15 +0900 Subject: [PATCH 2/2] docs(changelog): update PR reference --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba8d31b..146544a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Migrate Nix flake configuration from flake-utils to flake-parts. (#52) - Add autonomy and communication guidance for AI agents. (#42) - Document `nix develop` devShell usage in contributing guide. (#43) -- Split the Nix devShell into `nix/devshell/flake.nix`, keep the root package flake on `flake-parts`, and source coding agents from `llm-agents.nix`. (#52) +- Split the Nix devShell into `nix/devshell/flake.nix`, keep the root package flake on `flake-parts`, and source coding agents from `llm-agents.nix`. (#56) - Refine one-line descriptions (README, Nix flake metadata, Homebrew formula, and GitHub repository description). (#43) ### Changed