diff --git a/flake.lock b/flake.lock index 6f90ac9..847794b 100644 --- a/flake.lock +++ b/flake.lock @@ -149,21 +149,6 @@ "type": "github" } }, - "crane": { - "locked": { - "lastModified": 1775839657, - "narHash": "sha256-SPm9ck7jh3Un9nwPuMGbRU04UroFmOHjLP56T10MOeM=", - "owner": "ipetkov", - "repo": "crane", - "rev": "7cf72d978629469c4bd4206b95c402514c1f6000", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, "crate2nix": { "inputs": { "cachix": "cachix_2", @@ -537,24 +522,6 @@ "type": "github" } }, - "flake-utils_4": { - "inputs": { - "systems": "systems_6" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "ghostty": { "inputs": { "flake-compat": "flake-compat_4", @@ -1025,22 +992,6 @@ } }, "nixpkgs_11": { - "locked": { - "lastModified": 1767892417, - "narHash": "sha256-dhhvQY67aboBk8b0/u0XB6vwHdgbROZT3fJAjyNh5Ww=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_12": { "locked": { "lastModified": 1776169885, "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", @@ -1056,7 +1007,7 @@ "type": "github" } }, - "nixpkgs_13": { + "nixpkgs_12": { "locked": { "lastModified": 1778556142, "narHash": "sha256-n6P0m0ahFtMMkubMcHe4ole6N01B2Ywhz8ROq6ncSxk=", @@ -1282,7 +1233,6 @@ "nixpkgs-unstable": "nixpkgs-unstable", "portal-nix-overlay": "portal-nix-overlay", "sesame": "sesame", - "worktrunk": "worktrunk", "wrk": "wrk", "zmx": "zmx" } @@ -1329,27 +1279,6 @@ "type": "github" } }, - "rust-overlay_3": { - "inputs": { - "nixpkgs": [ - "worktrunk", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1776050130, - "narHash": "sha256-/f/6/1WOfBJaGMfqV3VxWD9lpFRbPpF+Cx4MO+0mGok=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "3c27f4c92a7d977556dd2c10bb564d9c61b375e9", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, "sesame": { "inputs": { "flake-utils": "flake-utils", @@ -1445,21 +1374,6 @@ "type": "github" } }, - "systems_6": { - "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": [ @@ -1503,32 +1417,10 @@ "type": "github" } }, - "worktrunk": { - "inputs": { - "crane": "crane", - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_11", - "rust-overlay": "rust-overlay_3" - }, - "locked": { - "lastModified": 1776457586, - "narHash": "sha256-ji6eim3ed6+/OrW5WqsrEYVTbND3it3pIFRc3uarftI=", - "owner": "max-sixty", - "repo": "worktrunk", - "rev": "c1fad73f36f963e55b281d8fe24d69db696e255e", - "type": "github" - }, - "original": { - "owner": "max-sixty", - "ref": "v0.39.0", - "repo": "worktrunk", - "type": "github" - } - }, "wrk": { "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_12" + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_11" }, "locked": { "lastModified": 1778703739, @@ -1578,8 +1470,8 @@ }, "zig2nix": { "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_13" + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_12" }, "locked": { "lastModified": 1778610364, diff --git a/flake.nix b/flake.nix index 8071205..dd5128b 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,6 @@ nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; llm-agents.url = "github:numtide/llm-agents.nix"; devenv.url = "github:cachix/devenv/v2.1"; - worktrunk.url = "github:max-sixty/worktrunk/v0.39.0"; zmx.url = "github:neurosnap/zmx"; expert = { url = "github:elixir-lang/expert"; diff --git a/modules/ai.nix b/modules/ai.nix index 69a88ee..e75236c 100644 --- a/modules/ai.nix +++ b/modules/ai.nix @@ -57,6 +57,47 @@ let command = "${kagiWrapper}"; }; }; + + codexMcpConfig = (pkgs.formats.toml { }).generate "codex-mcp.toml" { + mcp_servers = mcpServers; + }; + + # Keep Codex's main config writable so it can persist runtime state such as + # project and hook trust. Home Manager owns only the marked MCP section. + codexConfigSetup = '' + config_dir="''${CODEX_HOME:-$HOME/.codex}" + config_file="$config_dir/config.toml" + mkdir -p "$config_dir" + + if [ -L "$config_file" ]; then + tmp_file="$(${pkgs.coreutils}/bin/mktemp "$config_file.tmp.XXXXXX")" + ${pkgs.coreutils}/bin/cp -L "$config_file" "$tmp_file" + ${pkgs.coreutils}/bin/rm "$config_file" + ${pkgs.coreutils}/bin/mv "$tmp_file" "$config_file" + elif [ ! -e "$config_file" ]; then + ${pkgs.coreutils}/bin/touch "$config_file" + fi + + stripped_file="$(${pkgs.coreutils}/bin/mktemp "$config_file.stripped.XXXXXX")" + tmp_file="$(${pkgs.coreutils}/bin/mktemp "$config_file.tmp.XXXXXX")" + + ${pkgs.gawk}/bin/awk ' + $0 == "# BEGIN home-manager managed mcp_servers" { skip = 1; next } + $0 == "# END home-manager managed mcp_servers" { skip = 0; next } + !skip { print } + ' "$config_file" > "$stripped_file" + + { + ${pkgs.coreutils}/bin/cat "$stripped_file" + printf '\n# BEGIN home-manager managed mcp_servers\n' + ${pkgs.coreutils}/bin/cat ${codexMcpConfig} + printf '# END home-manager managed mcp_servers\n' + } > "$tmp_file" + + ${pkgs.coreutils}/bin/mv "$tmp_file" "$config_file" + ${pkgs.coreutils}/bin/rm -f "$stripped_file" + ${pkgs.coreutils}/bin/chmod 600 "$config_file" + ''; in { options.profiles.ai = { @@ -68,7 +109,6 @@ in enable = true; package = codex; settings = null; - profiles.home-manager.mcp_servers = mcpServers; }; programs.claude-code = { @@ -110,6 +150,8 @@ in playwright-cli ]; + home.activation.codexConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] codexConfigSetup; + home.file = { ".codex/skills/audit-nix-app-updates" = { source = ../config/codex/skills/audit-nix-app-updates; diff --git a/modules/shell.nix b/modules/shell.nix index ab9e085..ca223dd 100644 --- a/modules/shell.nix +++ b/modules/shell.nix @@ -7,7 +7,8 @@ }: let cfg = config.profiles.shell; - wt = inputs.worktrunk.packages.${pkgs.system}.default; + pkgs-unstable = import inputs.nixpkgs-unstable { inherit (pkgs) system; }; + wt = pkgs-unstable.worktrunk; devenv = inputs.devenv.packages.${pkgs.system}.default; in { @@ -304,7 +305,7 @@ in dc = "dclaude"; dcc = "dclaude --continue"; dcr = "dclaude --resume"; - cdx = "codex --profile home-manager --yolo"; + cdx = "codex --yolo"; wtrm = "wt remove --force"; wtrmm = "wt remove --force --no-hooks -D"; diff --git a/pkgs/hermes-desktop/default.nix b/pkgs/hermes-desktop/default.nix index b5fe5f3..cd2f4d4 100644 --- a/pkgs/hermes-desktop/default.nix +++ b/pkgs/hermes-desktop/default.nix @@ -6,8 +6,8 @@ }: let - version = "0.17.0"; - rev = "413ed6b9df18f22152d26b6de4093280dcb2b16b"; + version = "0.18.2"; + rev = "9de9c25f620ff7f1ce0fd5457d596052d5159596"; in buildNpmPackage { pname = "hermes-desktop"; @@ -17,11 +17,11 @@ buildNpmPackage { owner = "NousResearch"; repo = "hermes-agent"; inherit rev; - hash = "sha256-wek7P9tdrqRk/ArxBXt/X3BJpQ+wcnKFqG0S+ryx5p0="; + hash = "sha256-RieWkLWEn21aamFvQTTnJwwQl00JJGgp3LvY3D3G3jQ="; }; npmWorkspace = "apps/desktop"; - npmDepsHash = "sha256-RqQyEqzeSlywA83+S9d0KXBnirIVPNFixXCyaE523zo="; + npmDepsHash = "sha256-qDXGL/INHPW0pTF4SRVL1dS5XVh2X85dEE4JhrAQeqU="; env = { ELECTRON_SKIP_BINARY_DOWNLOAD = "1";