Compare commits

..
2 Commits
Author SHA1 Message Date
hektor 0ab7dc5d80 feat(ai-tools): declare Codex submodule
check / lint (push) Successful in 15s
2026-10-12 23:44:18 +02:00
hektor 622a2ae3da fix(ai-tools): adopt 'taskwarrior' home manager secrets approach 2026-10-12 23:44:18 +02:00
5 changed files with 67 additions and 38 deletions

No files matched your search

+1
View File
@@ -25,6 +25,7 @@
}; };
ai-tools = { ai-tools = {
claude-code.enable = true; claude-code.enable = true;
codex.enable = true;
opencode.enable = true; opencode.enable = true;
}; };
anki.enable = true; anki.enable = true;
+13
View File
@@ -0,0 +1,13 @@
{
lib,
config,
pkgs,
...
}:
{
config = lib.mkIf config.ai-tools.codex.enable {
programs.codex.enable = true;
home.packages = with pkgs; [ codex ];
};
}
+4
View File
@@ -20,6 +20,9 @@ in
default = [ ]; default = [ ];
}; };
}; };
codex = {
enable = lib.mkEnableOption "codex";
};
opencode = { opencode = {
enable = lib.mkEnableOption "opencode"; enable = lib.mkEnableOption "opencode";
}; };
@@ -31,6 +34,7 @@ in
imports = [ imports = [
./claude-code.nix ./claude-code.nix
./fabric.nix ./fabric.nix
./codex.nix
./opencode.nix ./opencode.nix
./skills.nix ./skills.nix
./tirith.nix ./tirith.nix
+48 -36
View File
@@ -2,49 +2,61 @@
config, config,
lib, lib,
pkgs, pkgs,
myUtils,
osConfig ? null,
inputs ? null,
... ...
}: }:
let let
cfg = config.ai-tools.opencode; sops = myUtils.sopsAvailability config osConfig;
standalone = osConfig == null;
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf config.ai-tools.opencode.enable (
secrets.files.opencode = [ "api-key" ]; lib.optionalAttrs standalone {
secrets.templates."opencode/auth.json" = { sops = {
path = ".local/share/opencode/auth.json"; secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" {
content = '' opencode = [ "api-key" ];
{
"zai-coding-plan": {
"type": "api",
"key": "${config.sops.placeholder."opencode/api-key"}"
}
}
'';
};
home.packages = [ pkgs.opencode ];
home.file.".config/opencode/opencode.json".text = builtins.toJSON {
"$schema" = "https://opencode.ai/config.json";
permission = {
external_directory = {
"/run/secrets/" = "deny";
"~/.config/sops/age/keys.txt" = "deny";
"~/.ssh/id_rsa" = "deny";
"~/.ssh/id_ed25519" = "deny";
"~/.ssh/id_ecdsa" = "deny";
"~/.ssh/id_dsa" = "deny";
"/etc/ssh/ssh_host_rsa_key" = "deny";
"/etc/ssh/ssh_host_ed25519_key" = "deny";
"/etc/ssh/ssh_host_ecdsa_key" = "deny";
"/etc/ssh/ssh_host_dsa_key" = "deny";
}; };
command = { templates."opencode/auth.json" = {
sops = "deny"; path = "${config.home.homeDirectory}/.local/share/opencode/auth.json";
content = builtins.toJSON {
zai-coding-plan = {
type = "api";
key = config.sops.placeholder."opencode/api-key";
};
};
}; };
}; };
plugin = [ "@mohak34/opencode-notifier@latest" ]; }
}; // {
}; warnings =
lib.optional (!sops.available)
"opencode is enabled, but sops templates are not available. the opencode API key will not be configured.";
home.packages = [ pkgs.opencode ];
home.file.".config/opencode/opencode.json".text = builtins.toJSON {
"$schema" = "https://opencode.ai/config.json";
permission = {
external_directory = {
"/run/secrets/" = "deny";
"~/.config/sops/age/keys.txt" = "deny";
"~/.ssh/id_rsa" = "deny";
"~/.ssh/id_ed25519" = "deny";
"~/.ssh/id_ecdsa" = "deny";
"~/.ssh/id_dsa" = "deny";
"/etc/ssh/ssh_host_rsa_key" = "deny";
"/etc/ssh/ssh_host_ed25519_key" = "deny";
"/etc/ssh/ssh_host_ecdsa_key" = "deny";
"/etc/ssh/ssh_host_dsa_key" = "deny";
};
command = {
sops = "deny";
};
};
plugin = [ "@mohak34/opencode-notifier@latest" ];
};
}
);
} }
+1 -2
View File
@@ -9,7 +9,6 @@
}: }:
let let
cfg = config.taskwarrior;
sops = myUtils.sopsAvailability config osConfig; sops = myUtils.sopsAvailability config osConfig;
standalone = osConfig == null; standalone = osConfig == null;
@@ -62,7 +61,7 @@ in
{ {
options.taskwarrior.enable = lib.mkEnableOption "taskwarrior"; options.taskwarrior.enable = lib.mkEnableOption "taskwarrior";
config = lib.mkIf cfg.enable ( config = lib.mkIf config.taskwarrior.enable (
lib.optionalAttrs standalone { lib.optionalAttrs standalone {
sops = { sops = {
secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" { secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" {