Files
home-manager/tests/modules/programs/codex/profiles-legacy-warning.nix
Austin Horstman d456f483f1 codex: add profile config support
Codex 0.134.0 stopped reading profile settings from [profiles.<name>] in config.toml and no longer supports the top-level profile selector.

Add a dedicated programs.codex.profiles option so Home Manager can write CODEX_HOME/<name>.config.toml files that match the current CLI --profile behavior. For Codex 0.134.0 and later, legacy programs.codex.settings.profiles entries are migrated into profile files with a warning, and removed legacy profile keys are omitted from config.toml so strict config loading keeps working. Older Codex versions keep the legacy config shape.
2026-06-18 08:19:47 -05:00

42 lines
1.2 KiB
Nix

{ pkgs, ... }:
let
codexPackage = pkgs.runCommand "codex-0.134.0" { } ''
mkdir -p $out/bin
echo '#!/bin/sh' > $out/bin/codex
chmod +x $out/bin/codex
'';
in
{
programs.codex = {
enable = true;
package = codexPackage;
settings = {
model = "gpt-5";
profile = "deep-review";
profiles.deep-review = {
approval_policy = "on-request";
sandbox_mode = "workspace-write";
};
};
};
test.asserts.warnings.expected = [
''
`programs.codex.settings.profile` and `programs.codex.settings.profiles`
are no longer supported by Codex 0.134.0 and later. Home Manager
now writes entries from `programs.codex.settings.profiles` to
`CODEX_HOME/<name>.config.toml`. Move them to
`programs.codex.profiles` and remove `programs.codex.settings.profile`.
''
];
nmt.script = ''
assertFileExists home-files/.codex/config.toml
assertFileContent home-files/.codex/config.toml \
${./profiles-legacy-warning.toml}
assertFileExists home-files/.codex/deep-review.config.toml
assertFileContent home-files/.codex/deep-review.config.toml \
${./profiles-legacy-warning-deep-review.toml}
'';
}