From 86d5cc3d328d431c860fca1e35e87e151de05e6b Mon Sep 17 00:00:00 2001 From: GarandPLG Date: Sun, 18 Oct 2026 19:33:33 +0200 Subject: [PATCH] Enable OpenCode and add its configuration Enable the OpenCode service on both desktop and laptop hosts. Import the opencode module into the home configuration and provide settings, plugins, extra packages, and skill definitions for full functionality. --- hosts/Garand-Desktop/home-modules.nix | 2 +- hosts/Garand-Laptop/home-modules.nix | 2 +- modules/home/codex/default.nix | 3 ++ modules/home/default.nix | 2 +- .../{opencode.nix => opencode/default.nix} | 10 ++++++ modules/home/opencode/extra-packages.nix | 12 +++++++ modules/home/opencode/settings/default.nix | 16 +++++++++ modules/home/opencode/settings/formatter.nix | 35 +++++++++++++++++++ modules/home/opencode/settings/model.nix | 7 ++++ modules/home/opencode/settings/permission.nix | 13 +++++++ modules/home/opencode/settings/plugin.nix | 7 ++++ modules/home/opencode/skills/default.nix | 5 +++ .../opencode/skills/understand-anything.nix | 22 ++++++++++++ 13 files changed, 133 insertions(+), 3 deletions(-) rename modules/home/{opencode.nix => opencode/default.nix} (60%) create mode 100644 modules/home/opencode/extra-packages.nix create mode 100644 modules/home/opencode/settings/default.nix create mode 100644 modules/home/opencode/settings/formatter.nix create mode 100644 modules/home/opencode/settings/model.nix create mode 100644 modules/home/opencode/settings/permission.nix create mode 100644 modules/home/opencode/settings/plugin.nix create mode 100644 modules/home/opencode/skills/default.nix create mode 100644 modules/home/opencode/skills/understand-anything.nix diff --git a/hosts/Garand-Desktop/home-modules.nix b/hosts/Garand-Desktop/home-modules.nix index 30edf50..d413bbe 100644 --- a/hosts/Garand-Desktop/home-modules.nix +++ b/hosts/Garand-Desktop/home-modules.nix @@ -7,7 +7,7 @@ _: { enable = true; # Zed Editor: a modern, high‑performance code editor remote-server.enable = false; # Remote Server: enable remote editing capabilities }; - opencode.enable = false; # OpenCode: terminal coding agent + opencode.enable = true; # OpenCode: terminal coding agent codex.enable = true; # Codex: Lightweight coding agent that runs in your terminal ollama.enable = false; # Ollama: Local Llms diff --git a/hosts/Garand-Laptop/home-modules.nix b/hosts/Garand-Laptop/home-modules.nix index 0509041..285d1dd 100644 --- a/hosts/Garand-Laptop/home-modules.nix +++ b/hosts/Garand-Laptop/home-modules.nix @@ -7,7 +7,7 @@ _: { enable = true; # Zed Editor: a modern, high‑performance code editor remote-server.enable = false; # Remote Server: enable remote editing capabilities }; - opencode.enable = false; # OpenCode: terminal coding agent + opencode.enable = true; # OpenCode: terminal coding agent codex.enable = true; # Codex: Lightweight coding agent that runs in your terminal ollama.enable = false; # Ollama: Local Llms diff --git a/modules/home/codex/default.nix b/modules/home/codex/default.nix index 778250f..33dd201 100644 --- a/modules/home/codex/default.nix +++ b/modules/home/codex/default.nix @@ -10,6 +10,9 @@ enable = true; package = pkgs.codex; mutableSettings = true; + # skills = { + # beads = "${pkgs.beads.src}/plugins/beads/skills/beads"; + # }; }; imports = [ diff --git a/modules/home/default.nix b/modules/home/default.nix index 763a220..8819b0c 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -11,6 +11,7 @@ _: { ./noctalia # ./noctalia-shell ./obsidian + ./opencode ./scripts ./vscodium ./xdg @@ -35,7 +36,6 @@ _: { ./obs-studio.nix ./ollama.nix ./onlyoffice.nix - ./opencode.nix ./prismlauncher.nix ./qt.nix ./skills.nix diff --git a/modules/home/opencode.nix b/modules/home/opencode/default.nix similarity index 60% rename from modules/home/opencode.nix rename to modules/home/opencode/default.nix index ae3d839..af22e8d 100644 --- a/modules/home/opencode.nix +++ b/modules/home/opencode/default.nix @@ -9,5 +9,15 @@ config.programs.opencode = lib.mkIf config.opencode.enable { enable = true; package = pkgs.opencode; + validateFiles = { + config = true; + tui = true; + }; }; + + imports = [ + ./settings + ./skills + ./extra-packages.nix + ]; } diff --git a/modules/home/opencode/extra-packages.nix b/modules/home/opencode/extra-packages.nix new file mode 100644 index 0000000..e4aaf38 --- /dev/null +++ b/modules/home/opencode/extra-packages.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: { + programs.opencode.extraPackages = with pkgs; [ + uv + ruff + biome + bun + beads + rust-analyzer + alejandra + docker + ]; +} diff --git a/modules/home/opencode/settings/default.nix b/modules/home/opencode/settings/default.nix new file mode 100644 index 0000000..a59aab6 --- /dev/null +++ b/modules/home/opencode/settings/default.nix @@ -0,0 +1,16 @@ +_: { + programs.opencode.settings = { + autoupdate = false; + compaction = { + auto = true; + prune = false; + }; + }; + + imports = [ + ./formatter.nix + ./model.nix + ./permission.nix + ./plugin.nix + ]; +} diff --git a/modules/home/opencode/settings/formatter.nix b/modules/home/opencode/settings/formatter.nix new file mode 100644 index 0000000..c2d2d6e --- /dev/null +++ b/modules/home/opencode/settings/formatter.nix @@ -0,0 +1,35 @@ +_: { + programs.opencode.settings.formatter = { + gofmt.disabled = true; + mix.disabled = true; + prettier.disabled = true; + zig.disabled = true; + clang-format.disabled = true; + ktlint.disabled = true; + rubocop.disabled = true; + standardrb.disabled = true; + htmlbeautifier.disabled = true; + air.disabled = true; + dart.disabled = true; + dfmt.disabled = true; + ocamlformat.disabled = true; + terraform.disabled = true; + gleam.disabled = true; + nixfmt.disabled = true; + shfmt.disabled = true; + pint.disabled = true; + oxfmt.disabled = true; + ormolu.disabled = true; + + # biome = {}; + # ruff = {}; + # rustfmt = {}; + # cargo = {}; + # uv = {}; + + alejandra = { + command = ["alejandra" "$FILE"]; + extensions = [".nix"]; + }; + }; +} diff --git a/modules/home/opencode/settings/model.nix b/modules/home/opencode/settings/model.nix new file mode 100644 index 0000000..6e7dcfa --- /dev/null +++ b/modules/home/opencode/settings/model.nix @@ -0,0 +1,7 @@ +_: { + programs.opencode.settings = { + model = "cerebras/gpt-oss-120b"; + small_model = "cerebras/qwen-3.8-27b"; + enabled_providers = ["cerebras"]; + }; +} diff --git a/modules/home/opencode/settings/permission.nix b/modules/home/opencode/settings/permission.nix new file mode 100644 index 0000000..7fe2031 --- /dev/null +++ b/modules/home/opencode/settings/permission.nix @@ -0,0 +1,13 @@ +_: { + programs.opencode.settings.permission = { + bash = "allow"; + edit = "allow"; + grep = "allow"; + glob = "allow"; + lsp = "ask"; + skill = "allow"; + webfetch = "ask"; + websearch = "ask"; + question = "allow"; + }; +} diff --git a/modules/home/opencode/settings/plugin.nix b/modules/home/opencode/settings/plugin.nix new file mode 100644 index 0000000..af2cb40 --- /dev/null +++ b/modules/home/opencode/settings/plugin.nix @@ -0,0 +1,7 @@ +_: { + programs.opencode.settings.plugin = [ + "@dietrichgebert/ponytail" + "context-mode" + "opencode-mem" + ]; +} diff --git a/modules/home/opencode/skills/default.nix b/modules/home/opencode/skills/default.nix new file mode 100644 index 0000000..33a75d1 --- /dev/null +++ b/modules/home/opencode/skills/default.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./understand-anything.nix + ]; +} diff --git a/modules/home/opencode/skills/understand-anything.nix b/modules/home/opencode/skills/understand-anything.nix new file mode 100644 index 0000000..148b04c --- /dev/null +++ b/modules/home/opencode/skills/understand-anything.nix @@ -0,0 +1,22 @@ +{pkgs, ...}: let + understand-anything-src = pkgs.fetchFromGitHub { + name = "understand-anything"; + owner = "Egonex-AI"; + repo = "Understand-Anything"; + tag = "v2.9.0"; + sha256 = "sha256-nECfbp0vyFZRZX0Zg2s4ga/kYSCihJxYt9lxUHLGmFA="; + }; + understand-anything = "${understand-anything-src}/understand-anything-plugin/skills"; +in { + programs.opencode.skills = { + understand = "${understand-anything}/understand"; + understand-chat = "${understand-anything}/understand-chat"; + understand-dashboard = "${understand-anything}/understand-dashboard"; + understand-diff = "${understand-anything}/understand-diff"; + understand-domain = "${understand-anything}/understand-domain"; + understand-explain = "${understand-anything}/understand-explain"; + understand-figma = "${understand-anything}/understand-figma"; + understand-knowledge = "${understand-anything}/understand-knowledge"; + understand-onboard = "${understand-anything}/understand-onboard"; + }; +}