diff --git a/home/hosts/andromache/default.nix b/home/hosts/andromache/default.nix index 3b899b9..1b6e6bb 100644 --- a/home/hosts/andromache/default.nix +++ b/home/hosts/andromache/default.nix @@ -40,6 +40,7 @@ in xdg.userDirs.createDirectories = false; xdg.userDirs.download = "${config.home.homeDirectory}/dl"; + ai-tools.opencode.enable = true; browser.primary = "librewolf"; cloud.hetzner.enable = true; comms.signal.enable = true; diff --git a/home/hosts/astyanax/default.nix b/home/hosts/astyanax/default.nix index c7c39c3..4c0c3bc 100644 --- a/home/hosts/astyanax/default.nix +++ b/home/hosts/astyanax/default.nix @@ -37,6 +37,7 @@ in xdg.userDirs.createDirectories = false; xdg.userDirs.download = "${config.home.homeDirectory}/dl"; + ai-tools.opencode.enable = true; browser.primary = "librewolf"; cloud.hetzner.enable = true; comms.signal.enable = true; diff --git a/home/hosts/work/default.nix b/home/hosts/work/default.nix index bd702d3..6c7254e 100644 --- a/home/hosts/work/default.nix +++ b/home/hosts/work/default.nix @@ -70,6 +70,7 @@ in cloud.azure.enable = true; comms.signal.enable = true; comms.teams.enable = true; + ai-tools.claude-code.enable = true; github.enable = true; gitlab.enable = true; diff --git a/home/modules/ai-tools.nix b/home/modules/ai-tools.nix index af71b75..8171084 100644 --- a/home/modules/ai-tools.nix +++ b/home/modules/ai-tools.nix @@ -1,40 +1,79 @@ { + lib, + config, pkgs, ... }: +let + cfg = config.ai-tools; + rtk-version = "0.18.1"; +in { - config = { - home.packages = with pkgs; [ - aider-chat - (pkgs.stdenv.mkDerivation { - name = "ccline"; - src = pkgs.fetchurl { - url = "https://github.com/Haleclipse/CCometixLine/releases/download/v1.0.8/ccline-linux-x64.tar.gz"; - hash = "sha256-Joe3Dd6uSMGi66QT6xr2oY/Tz8rA5RuKa6ckBVJIzI0="; - }; - - unpackPhase = '' - tar xzf $src - ''; - - installPhase = '' - mkdir -p $out/bin - cp ccline $out/bin/ - chmod +x $out/bin/ccline - ''; - - meta = with pkgs.lib; { - description = "CCometixLine Linux x64 CLI (Claude Code statusline)"; - homepage = "https://github.com/Haleclipse/CCometixLine"; - license = licenses.mit; - platforms = [ "x86_64-linux" ]; - }; - }) - # claude-code - # (config.lib.nixGL.wrap code-cursor) - # github-copilot-cli - mcp-nixos - opencode - ]; + options.ai-tools = { + claude-code.enable = lib.mkEnableOption "claude code with rtk and ccline"; + opencode.enable = lib.mkEnableOption "opencode"; }; + + config = lib.mkMerge [ + (lib.mkIf cfg.claude-code.enable { + home.packages = with pkgs; [ + claude-code + (pkgs.stdenv.mkDerivation { + name = "ccline"; + src = pkgs.fetchurl { + url = "https://github.com/Haleclipse/CCometixLine/releases/download/v1.0.8/ccline-linux-x64.tar.gz"; + hash = "sha256-Joe3Dd6uSMGi66QT6xr2oY/Tz8rA5RuKa6ckBVJIzI0="; + }; + + unpackPhase = '' + tar xzf $src + ''; + + installPhase = '' + mkdir -p $out/bin + cp ccline $out/bin/ + chmod +x $out/bin/ccline + ''; + + meta = with pkgs.lib; { + description = "CCometixLine Linux x64 CLI (Claude Code statusline)"; + homepage = "https://github.com/Haleclipse/CCometixLine"; + license = licenses.mit; + platforms = [ "x86_64-linux" ]; + }; + }) + (pkgs.stdenv.mkDerivation { + name = "rtk-${rtk-version}"; + version = rtk-version; + src = pkgs.fetchurl { + url = "https://github.com/rtk-ai/rtk/releases/download/v${rtk-version}/rtk-x86_64-unknown-linux-gnu.tar.gz"; + hash = "sha256-XoTia5K8b00OzcKYCufwx8ApkAS31DxUCpGSU0jFs2Q="; + }; + + unpackPhase = '' + tar xzf $src + ''; + + installPhase = '' + mkdir -p $out/bin + cp rtk $out/bin/ + chmod +x $out/bin/rtk + ''; + + meta = with pkgs.lib; { + description = "RTK - AI coding tool enhancer"; + homepage = "https://www.rtk-ai.app"; + license = licenses.mit; + platforms = [ "x86_64-linux" ]; + }; + }) + mcp-nixos + ]; + }) + (lib.mkIf cfg.opencode.enable { + home.packages = with pkgs; [ + opencode + ]; + }) + ]; }