treewide: implement auto importing for modules
Reduce maintenance burden and increase efficiency by automatically importing modules following a specific convention. Co-authored-by: awwpotato <awwpotato@voidq.com> Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
fefeb0e928
commit
4fca600cb1
461 changed files with 72 additions and 474 deletions
67
modules/programs/codex/default.nix
Normal file
67
modules/programs/codex/default.nix
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.programs.codex;
|
||||
|
||||
settingsFormat = pkgs.formats.yaml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = [
|
||||
lib.hm.maintainers.delafthi
|
||||
];
|
||||
|
||||
options.programs.codex = {
|
||||
enable = lib.mkEnableOption "Lightweight coding agent that runs in your terminal";
|
||||
|
||||
package = lib.mkPackageOption pkgs "codex" { nullable = true; };
|
||||
|
||||
settings = lib.mkOption {
|
||||
inherit (settingsFormat) type;
|
||||
description = ''
|
||||
Configuration written to {file}`~/.codex/config.yaml`.
|
||||
See <https://github.com/openai/codex#configuration-guide> for supported values.
|
||||
'';
|
||||
default = { };
|
||||
defaultText = lib.literalExpression "{ }";
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
model = "gemma3:latest";
|
||||
provider = "ollama";
|
||||
providers = {
|
||||
ollama = {
|
||||
name = "Ollama";
|
||||
baseURL = "http://localhost:11434/v1";
|
||||
envKey = "OLLAMA_API_KEY";
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
custom-instructions = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
description = "Define custom guidance for the agents; this value is written to {file}~/.codex/AGENTS.md";
|
||||
default = "";
|
||||
example = lib.literalExpression ''
|
||||
'''
|
||||
- Always respond with emojis
|
||||
- Only use git commands when explicitly requested
|
||||
'''
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
home.file = {
|
||||
".codex/config.yaml".source = settingsFormat.generate "codex-config" cfg.settings;
|
||||
".codex/AGENTS.md".text = cfg.custom-instructions;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue