mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
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.
This commit is contained in:
parent
d8a475e179
commit
faa5b42eca
6 changed files with 78 additions and 12 deletions
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
home.preferXdgDirectories = true;
|
||||
programs.codex = {
|
||||
enable = true;
|
||||
custom-instructions = ''
|
||||
- Always respond with emojis
|
||||
- Only use git commands when explicitly requested
|
||||
'';
|
||||
};
|
||||
nmt.script = ''
|
||||
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'export CODEX_HOME="/home/hm-user/.config/codex"'
|
||||
assertFileExists home-files/.config/codex/AGENTS.md
|
||||
assertFileContent home-files/.config/codex/AGENTS.md \
|
||||
${./AGENTS.md}
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
codex-settings-toml = ./settings-toml.nix;
|
||||
codex-settings-toml-prefer-xdg-directories = ./settings-toml-prefer-xdg-directories.nix;
|
||||
codex-settings-yaml = ./settings-yaml.nix;
|
||||
codex-empty-settings = ./empty-settings.nix;
|
||||
codex-custom-instructions = ./custom-instructions.nix;
|
||||
codex-custom-instructions-prefer-xdg-directories = ./custom-instructions-prefer-xdg-directories.nix;
|
||||
codex-empty-custom-instructions = ./empty-custom-instructions.nix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,6 @@
|
|||
nmt.script = ''
|
||||
assertPathNotExists home-files/.codex/config.toml
|
||||
assertPathNotExists home-files/.codex/config.yaml
|
||||
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'CODEX_HOME'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
{ 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
|
||||
{
|
||||
home.preferXdgDirectories = true;
|
||||
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 = ''
|
||||
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'export CODEX_HOME="/home/hm-user/.config/codex"'
|
||||
assertFileExists home-files/.config/codex/config.toml
|
||||
assertFileContent home-files/.config/codex/config.toml \
|
||||
${./config.toml}
|
||||
'';
|
||||
}
|
||||
|
|
@ -26,5 +26,6 @@ in
|
|||
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'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue