1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-05 16:41:04 +01:00
home-manager/tests/modules/programs/codex/settings-toml.nix
Thierry Delafontaine faa5b42eca codex: support XDG Base Directory specification
- Configuration file is now placed in XDG_CONFIG_HOME/codex/config.toml by default for versions >=0.2.0 when preferXdgDirectories is enabled.
- Falls back to ~/.codex/config.yaml for versions <0.2.0 and to ~/.codex/config.toml when preferXdgDirectories is disabled
- Sets CODEX_HOME environment variable to $XDG_CONFIG_HOME/codex when using XDG directories.
- Updated tests to verify XDG directory behavior and environment variable presence.
2025-08-07 14:04:33 -05:00

31 lines
744 B
Nix

{ pkgs, ... }:
let
codexPackage = pkgs.runCommand "codex-0.2.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 = "gemma3:latest";
model_provider = "ollama";
model_providers = {
ollama = {
name = "Ollama";
baseURL = "http://localhost:11434/v1";
envKey = "OLLAMA_API_KEY";
};
};
};
};
nmt.script = ''
assertFileExists home-files/.codex/config.toml
assertFileContent home-files/.codex/config.toml \
${./config.toml}
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'CODEX_HOME'
'';
}