dotfiles

My PC Dotfiles & Website

modules/apps/ai/codex.nix (1497B)


 1## OpenAI Codex ##
 2{config, ...}: let
 3  inherit (config.flake) modules;
 4in {
 5  flake.modules.homeManager.codex = {
 6    config,
 7    lib,
 8    pkgs,
 9    ...
10  }: {
11    imports = [modules.homeManager.codex-cli];
12
13    programs.vscode.profiles.default.extensions =
14      lib.mkIf config.programs.vscode.enable
15      (with pkgs.vscode-marketplace.openai; [chatgpt codex-audio]);
16
17    home = {
18      packages = [pkgs.llm.chatgpt];
19      persist.directories = [".config/Codex" ".cache/Codex"];
20    };
21  };
22  flake.modules.homeManager.codex-cli = {
23    config,
24    pkgs,
25    ...
26  }: {
27    imports = [./_common.nix];
28
29    home = {
30      persist.directories = [".codex"];
31      file.".codex/config.toml" = {
32        force = true;
33        mutable = true;
34      };
35    };
36
37    programs.codex = {
38      enable = true;
39      package = pkgs.llm.codex;
40      enableMcpIntegration = true;
41      skills = config.ai._skills;
42
43      settings = {
44        approval_policy = "on-request";
45        personality = "pragmatic";
46        sandbox_mode = "workspace-write";
47        sandbox_workspace_write.network_access = true;
48        web_search = "live";
49
50        tui = {
51          notifications = true;
52          notification_condition = "unfocused";
53          status_line = [
54            "model-with-reasoning"
55            "current-dir"
56            "git-branch"
57            "approval-mode"
58            "context-remaining"
59            "weekly-limit"
60            "task-progress"
61          ];
62        };
63      };
64    };
65  };
66}