From e7ec6740f124e138685681a57906faa187bd493e Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Sat, 3 Oct 2026 21:34:14 +0100 Subject: [PATCH] home-manager/gui: Manage Codex with mutable settings Pin Codex independently through `llm-agents.nix` and update unstable home-manager for `programs.codex.mutableSettings`. Declare the status line, including both usage windows, while preserving imperative settings during activation. --- docs/deployment.md | 10 ++ flake.lock | 176 +++++++++++++++++++++++---- flake.nix | 2 + home-manager/modules/gui/default.nix | 22 +++- 4 files changed, 186 insertions(+), 24 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index baaebbe..d61d0e5 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -62,6 +62,16 @@ Generated profiles deploy in this order: `ssh-machine bash -s < script.sh`. If a flaky agent stalls public-key authentication, use `SSH_AUTH_SOCK= ssh-machine …`. +## Codex + +The shared GUI home-manager module installs Codex from the `llm-agents` input, retaining +that input's tested nixpkgs pin. Run `nix flake update llm-agents`, then switch the system +or home configuration to use the updated package. + +`programs.codex.mutableSettings` merges the declared status-line settings into the writable +`~/.codex/config.toml` during activation. Declared values take precedence on each switch; +other settings, including model selection, providers and project trust, remain imperative. + ## Devshell commands The repo ships a `numtide/devshell` ([`devshell/`](../devshell), entered via `direnv`). Run a diff --git a/flake.lock b/flake.lock index 2d919e7..afb08e3 100644 --- a/flake.lock +++ b/flake.lock @@ -8,7 +8,7 @@ "ragenix", "nixpkgs" ], - "systems": "systems_8" + "systems": "systems_9" }, "locked": { "lastModified": 1761656077, @@ -67,6 +67,40 @@ "type": "github" } }, + "bun2nix": { + "inputs": { + "flake-parts": [ + "llm-agents", + "flake-parts" + ], + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ], + "treefmt-nix": [ + "llm-agents", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1790001035, + "narHash": "sha256-1/SLBjSYBzDdDhvLQ83wrzBakyS/xNGgtxHGNuveOEQ=", + "owner": "Mic92", + "repo": "bun2nix", + "rev": "07a5bfc8ac36c5370199343fa620b69f63186e33", + "type": "github" + }, + "original": { + "owner": "Mic92", + "ref": "llm-agents", + "repo": "bun2nix", + "type": "github" + } + }, "copyparty": { "inputs": { "flake-utils": "flake-utils_5", @@ -295,6 +329,27 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1790898470, + "narHash": "sha256-zTwuwezD0w3hpga6a6P8emidzAZFyWqlNeRBlpWOOl8=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "024633cd702b10285db5cb19b40ad48d2399ba60", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "openwrt-imagebuilder", @@ -434,7 +489,7 @@ }, "flake-utils_8": { "inputs": { - "systems": "systems_6" + "systems": "systems_7" }, "locked": { "lastModified": 1731533236, @@ -452,7 +507,7 @@ }, "flake-utils_9": { "inputs": { - "systems": "systems_9" + "systems": "systems_10" }, "locked": { "lastModified": 1731533236, @@ -582,11 +637,11 @@ ] }, "locked": { - "lastModified": 1787487906, - "narHash": "sha256-zIdM+8teujHm5hc5MIPDnV7k2UeOOT/pFyFtWjOCwsY=", + "lastModified": 1790989254, + "narHash": "sha256-ZN+riaeFuE+DZ5zfqJiXlM12jLwZzeIXiNkU1YeHMXI=", "owner": "nix-community", "repo": "home-manager", - "rev": "cfba7ad5886b342b8dd63ba74354b3853ea4cfc9", + "rev": "acd21c5a3420a9d5fd0ed06299b10828267ef9ba", "type": "github" }, "original": { @@ -631,6 +686,28 @@ "type": "github" } }, + "llm-agents": { + "inputs": { + "bun2nix": "bun2nix", + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_6", + "systems": "systems_6", + "treefmt-nix": "treefmt-nix_2" + }, + "locked": { + "lastModified": 1791001326, + "narHash": "sha256-pwJhtpRcNX1pJ9luUy3Eh1EYUFsZjv5m2xSqZ1hEhMU=", + "owner": "numtide", + "repo": "llm-agents.nix", + "rev": "83984ebbbe5322b261d9fdc24eb15cf44f23abec", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "llm-agents.nix", + "type": "github" + } + }, "nix": { "flake": false, "locked": { @@ -840,6 +917,22 @@ "type": "github" } }, + "nixpkgs_6": { + "locked": { + "lastModified": 1790600678, + "narHash": "sha256-6k3n7X2UsZ6tAlWTz99RimiZab+17tMUrw9sRUcELiA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f45c6f04c2f013f004bf94e284e95d72898d9393", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "openwrt-feeds": { "inputs": { "nixpkgs": [ @@ -865,11 +958,11 @@ }, "openwrt-imagebuilder": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "nixpkgs": [ "nixpkgs-unstable" ], - "systems": "systems_7" + "systems": "systems_8" }, "locked": { "lastModified": 1787474509, @@ -946,6 +1039,7 @@ "home-manager-unstable": "home-manager-unstable", "impermanence": "impermanence", "libnetRepo": "libnetRepo", + "llm-agents": "llm-agents", "nixGL": "nixGL", "nixpkgs-mine": "nixpkgs-mine", "nixpkgs-mine-stable": "nixpkgs-mine-stable", @@ -992,6 +1086,21 @@ "type": "github" } }, + "systems_10": { + "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, @@ -1068,21 +1177,6 @@ } }, "systems_7": { - "locked": { - "lastModified": 1680978846, - "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", - "owner": "nix-systems", - "repo": "x86_64-linux", - "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "x86_64-linux", - "type": "github" - } - }, - "systems_8": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1097,6 +1191,21 @@ "type": "github" } }, + "systems_8": { + "locked": { + "lastModified": 1680978846, + "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", + "owner": "nix-systems", + "repo": "x86_64-linux", + "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "x86_64-linux", + "type": "github" + } + }, "systems_9": { "locked": { "lastModified": 1681028828, @@ -1133,6 +1242,27 @@ "type": "github" } }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1786901030, + "narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems_3" diff --git a/flake.nix b/flake.nix index b5d90ff..751fa91 100644 --- a/flake.nix +++ b/flake.nix @@ -69,6 +69,8 @@ openwrt-feeds.inputs.openwrt-imagebuilder.follows = "openwrt-imagebuilder"; # Packages not in nixpkgs + # Keep its tested nixpkgs pin so packages can use the upstream binary cache. + llm-agents.url = "github:numtide/llm-agents.nix"; borgthin.url = "github:devplayer0/borg"; # TODO: Update borgthin so this works # borgthin.inputs.nixpkgs.follows = "nixpkgs-mine"; diff --git a/home-manager/modules/gui/default.nix b/home-manager/modules/gui/default.nix index b3bae8f..f69ae34 100644 --- a/home-manager/modules/gui/default.nix +++ b/home-manager/modules/gui/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs', pkgs, config, ... }: +{ lib, pkgs', pkgs, inputs, config, ... }: let inherit (lib) genAttrs mkIf mkMerge mkForce mapAttrs mkOptionDefault mkDefault optional; inherit (lib.my) mkOpt' mkBoolOpt'; @@ -187,6 +187,26 @@ in }; }; + codex = { + enable = true; + package = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.codex; + mutableSettings = true; + settings.tui = { + status_line = [ + "model-with-reasoning" + "current-dir" + "five-hour-limit" + "weekly-limit" + "context-used" + "context-window-size" + "total-input-tokens" + "total-output-tokens" + "used-tokens" + ]; + status_line_use_colors = true; + }; + }; + claude-code = { enable = true; settings = {