diff --git a/darwin/kuro/services/default.nix b/darwin/kuro/services/default.nix index 918bb40..6c23610 100644 --- a/darwin/kuro/services/default.nix +++ b/darwin/kuro/services/default.nix @@ -2,7 +2,6 @@ imports = [ ./tailscale.nix ./aerospace.nix - # ./ollama.nix ./skhd.nix ./yabai.nix ]; diff --git a/darwin/kuro/services/ollama.nix b/darwin/kuro/services/ollama.nix deleted file mode 100644 index f128c2c..0000000 --- a/darwin/kuro/services/ollama.nix +++ /dev/null @@ -1,16 +0,0 @@ -{pkgs, ...}: { - imports = [../../../modules/macos/ollama.nix]; - services.ollama = { - enable = true; - host = "127.0.0.1"; - port = 11434; - loadModels = [ - "deepseek-r1:7b" - # "deepseek-r1:14b" - # "RobinBially/nomic-embed-text-8k" - ]; - environmentVariables = { - OLLAMA_ORIGINS = "*"; - }; - }; -} diff --git a/home/programs/aichat.nix b/home/programs/aichat.nix deleted file mode 100644 index faa398e..0000000 --- a/home/programs/aichat.nix +++ /dev/null @@ -1,194 +0,0 @@ -{ - pkgs, - config, - lib, - device, - ... -}: { - imports = [ - ../../modules/aichat.nix - ]; - - disabledModules = ["programs/aichat.nix"]; - - config = lib.mkIf (!device.isServer) { - sops = { - secrets."llama/api_key" = {}; - secrets."openai/api_key" = {}; - secrets."openrouter/api_key" = {}; - secrets."gemini/api_key" = {}; - }; - programs.aichat = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = false; - settings = { - save_session = true; - model = "chutes:zai-org/GLM-5-Turbo"; - rag_embedding_model = "ryu:RobinBially/nomic-embed-text-8k"; - clients = [ - { - type = "openai-compatible"; - name = "ryu"; - api_base = "https://ollama.darksailor.dev/v1"; - api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}"; - models = [ - { - name = "gpt-oss:20b"; - type = "chat"; - } - # { - # name = "gpt-oss:20b-instruct"; - # type = "chat"; - # real_name = "gpt-oss:20b"; - # patch = { - # body = { - # think = "low"; - # }; - # }; - # } - { - name = "qwen3:30b-a3b"; - type = "chat"; - } - { - name = "RobinBially/nomic-embed-text-8k"; - type = "embedding"; - default_chunk_size = 1000; - max_tokens_per_chunk = 8192; - max_batch_size = 100; - } - # { - # name = "deepseek-r1:14b"; - # type = "chat"; - # } - # { - # name = "qwen3:8b"; - # type = "chat"; - # } - ]; - } - { - type = "openai-compatible"; - name = "chutes"; - api_base = "https://llm.chutes.ai/v1"; - api_key_cmd = "op item get chutes.ai --fields token --reveal"; - models = [ - { - name = "zai-org/GLM-5-Turbo"; - type = "chat"; - } - ]; - } - { - type = "gemini"; - name = "gemini"; - api_base = "https://generativelanguage.googleapis.com/v1beta"; - api_key_cmd = "cat ${config.sops.secrets."gemini/api_key".path}"; - # api_key_file = "${config.sops.secrets."gemini/api_key".path}"; - models = [ - { - name = "gemini-2.5-pro"; - type = "chat"; - } - ]; - } - { - type = "openai-compatible"; - name = "openrouter"; - api_base = "https://openrouter.ai/api/v1"; - api_key_cmd = "cat ${config.sops.secrets."openrouter/api_key".path}"; - models = [ - { - name = "deepseek/deepseek-r1:free"; - type = "chat"; - } - ]; - } - { - type = "openai-compatible"; - name = "kuro"; - api_base = "http://kuro:1234/v1"; - models = [ - { - name = "openai/gpt-oss-20b"; - type = "chat"; - } - ]; - } - { - type = "openai-compatible"; - name = "shiro"; - api_base = "http://shiro:1234/v1"; - models = [ - { - name = "openai/gpt-oss-20b"; - type = "chat"; - } - ]; - } - { - type = "openai"; - name = "openai"; - api_base = "https://api.openai.com/v1"; - api_key_cmd = "cat ${config.sops.secrets."openai/api_key".path}"; - models = [ - { - name = "gpt-3.5-turbo"; - } - { - name = "gpt-5-nano"; - } - { - name = "o4-mini-high"; - } - ]; - } - { - type = "openai-compatible"; - name = "copilot"; - api_key = "xxx"; # exchange your `ghu_` token at https://api.github.com/copilot_internal/v2/token with Bearer token - api_base = "https://api.githubcopilot.com"; - patch = { - # Patch api - chat_completions = { - # Api type, possible values: chat_completions, embeddings, and rerank - ".*" = { - # The regex to match model names, e.g. '.*' 'gpt-4o' 'gpt-4o|gpt-4-.*' - headers = { - # Patch request headers - "Copilot-Integration-Id" = "vscode-chat"; - "Editor-Version:" = "aichat/0.1.0"; # optional - }; - }; - }; - }; - } - ]; - document_loaders = { - git = - /* - sh - */ - ''sh -c "yek $1 --json | jq '[.[] | { path: .filename, contents: .content }]'"''; - }; - }; - roles = { - "git-commit" = - /* - md - */ - '' - --- - model: chutes:zai-org/GLM-5-Turbo - --- - Your task is to generate a concise and informative commit message based on the provided diff. Use the conventional commit format, which includes a type (feat, fix, chore, docs, style, refactor, perf, test) and an optional scope. The message should be in the imperative mood and should not exceed 72 characters in the subject line. Do not under any circumstance include any additional text or explanations, just add the commit message. - ''; - }; - extraPackages = with pkgs; [ - jq - yek - ]; - }; - }; -} diff --git a/home/programs/default.nix b/home/programs/default.nix index 597b92b..0c19cc1 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -29,7 +29,6 @@ ./1password-cli.nix ./aerc.nix - ./aichat.nix ./aria2.nix ./atuin.nix ./bat.nix diff --git a/home/programs/opencode.nix b/home/programs/opencode.nix index 7f9f380..55fa9fb 100644 --- a/home/programs/opencode.nix +++ b/home/programs/opencode.nix @@ -22,30 +22,6 @@ lib.optionalAttrs (device.is "ryu" || device.is "kuro" || device.is "shiro") { plugin = [ "@whisperopencode/push" ]; - - provider = { - ollama = { - models = { - "glm-4.7-flash" = { - name = "glm-4.7-flash"; - }; - "gemma4:31b" = { - name = "gemma4:31b"; - }; - "gemma4:26b256k" = { - name = "gemma4:26b256k"; - }; - "gemma4:26b100k" = { - name = "gemma4:26b100k"; - }; - }; - name = "Ollama (local)"; - npm = "@ai-sdk/openai-compatible"; - options = { - baseURL = "https://ollama.darksailor.dev/v1"; - }; - }; - }; }; web = { enable = true; diff --git a/home/scripts.nix b/home/scripts.nix index 64f1731..1c30a11 100644 --- a/home/scripts.nix +++ b/home/scripts.nix @@ -32,14 +32,6 @@ in { exec $EDITOR "$1" ''; }) - ( - pkgs.writeShellApplication { - name = "git-install-prepare-commit-msg"; - text = '' - ln -sf ${../scripts/prepare-commit-msg} .git/hooks/prepare-commit-msg - ''; - } - ) (mkScript ../scripts/yt-dlp.sh (with pkgs; [yt-dlp])) (mkScript ../scripts/autossh.sh (with pkgs; [autossh openssh])) ]; diff --git a/home/services/default.nix b/home/services/default.nix index fc12535..4fa6abe 100644 --- a/home/services/default.nix +++ b/home/services/default.nix @@ -9,7 +9,6 @@ ./ironbar ./kdeconnect.nix # ./remmina.nix - # ./ollama.nix ./swaync.nix ./swayosd.nix ./xdg.nix diff --git a/home/services/ollama.nix b/home/services/ollama.nix deleted file mode 100644 index 092e83f..0000000 --- a/home/services/ollama.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - pkgs, - device, - ... -}: { - services.ollama.enable = device.is "shiro"; -} diff --git a/modules/aichat.nix b/modules/aichat.nix deleted file mode 100644 index ef1227d..0000000 --- a/modules/aichat.nix +++ /dev/null @@ -1,126 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.programs.aichat; - yamlFormat = pkgs.formats.yaml {}; - fishIntegration = '' - function _aichat_fish - set -l _old (commandline) - if test -n $_old - echo -n "⌛" - commandline -f repaint - commandline (aichat -e $_old) - end - end - bind \co _aichat_fish''; - nuIntegration = '' - def _aichat_nushell [] { - let _prev = (commandline) - if ($_prev != "") { - print '⌛' - commandline edit -r (aichat -e $_prev) - } - } - - $env.config.keybindings = ($env.config.keybindings | append { - name: aichat_integration - modifier: control - keycode: char_o - mode: [emacs, vi_insert] - event:[ - { - send: executehostcommand, - cmd: "_aichat_nushell" - } - ] - } - ) - ''; - bashIntegration = '' - _aichat_bash() { - if [[ -n "$READLINE_LINE" ]]; then - READLINE_LINE=$(aichat -e "$READLINE_LINE") - READLINE_POINT=''${#READLINE_LINE} - fi - } - bind -x '"\co": _aichat_bash' - ''; - zshIntegration = '' - _aichat_zsh() { - if [[ -n "$BUFFER" ]]; then - local _old=$BUFFER - BUFFER+="⌛" - zle -I && zle redisplay - BUFFER=$(aichat -e "$_old") - zle end-of-line - fi - } - zle -N _aichat_zsh - bindkey '\co' _aichat_zsh - ''; -in { - options = { - programs.aichat = { - enable = mkEnableOption "aichat"; - package = mkPackageOption pkgs "aichat" {}; - - enableFishIntegration = mkEnableOption "Fish integration" // {default = true;}; - enableBashIntegration = mkEnableOption "Bash integration" // {default = true;}; - enableZshIntegration = mkEnableOption "Zsh integration" // {default = true;}; - enableNushellIntegration = mkEnableOption "Nushell integration" // {default = true;}; - - settings = lib.mkOption { - type = yamlFormat.type; - description = "Settings"; - }; - roles = lib.mkOption { - type = lib.types.attrsOf lib.types.str; - default = {}; - description = "Roles for the AI chat clients"; - }; - extraPackages = mkOption { - type = lib.types.listOf lib.types.package; - default = []; - example = literalExpression "with pkgs; [ jq yek ];"; - description = '' - Additional packages to install. - ''; - }; - }; - }; - - config = let - api_key_files = concatStringsSep " " (builtins.map (client: ''--run "export ${lib.toUpper client.name}_API_KEY=\`cat -v ${client.api_key_file}\`"'') (builtins.filter (client: (builtins.hasAttr "api_key_file" client)) cfg.settings.clients)); - api_key_cmds = concatStringsSep " " (builtins.map (client: ''--run "export ${lib.toUpper client.name}_API_KEY=\`${client.api_key_cmd}\`"'') (builtins.filter (client: (builtins.hasAttr "api_key_cmd" client)) cfg.settings.clients)); - - aichat-wrapped = pkgs.symlinkJoin { - name = "aichat"; - paths = [ - cfg.package - ]; - buildInputs = [pkgs.makeWrapper]; - postBuild = '' - wrapProgram $out/bin/aichat ${api_key_files} ${api_key_cmds} - ''; - }; - in { - home.packages = mkIf cfg.enable ([aichat-wrapped] ++ cfg.extraPackages); - - programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration fishIntegration; - programs.bash.initExtra = mkIf cfg.enableBashIntegration bashIntegration; - programs.zsh.initExtra = mkIf cfg.enableZshIntegration zshIntegration; - programs.nushell.extraConfig = mkIf cfg.enableNushellIntegration nuIntegration; - - xdg.configFile = mkIf cfg.enable ( - { - "aichat/config.yaml".source = - yamlFormat.generate "config.yaml" cfg.settings; - } - // (mapAttrs' (name: role: nameValuePair "aichat/roles/${name}.md" {text = role;}) cfg.roles) - ); - }; -} diff --git a/modules/darwin/ollama.nix b/modules/darwin/ollama.nix deleted file mode 100644 index 4c1a6c7..0000000 --- a/modules/darwin/ollama.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.services.ollama; -in { - options = { - services.ollama = { - enable = mkEnableOption "Ollama AI model runner"; - - package = mkOption { - type = types.package; - default = pkgs.ollama; - defaultText = literalExpression "pkgs.ollama"; - description = "The ollama package to use."; - }; - - host = mkOption { - type = types.str; - default = "127.0.0.1"; - description = "The host address to listen on."; - }; - - port = mkOption { - type = types.port; - default = 11434; - description = "The port to listen on."; - }; - - environmentVariables = mkOption { - type = types.attrs; - default = {}; - description = "Environment variables to set for the Ollama service."; - }; - - loadModels = mkOption { - type = types.listOf types.str; - default = []; - description = "List of models to load on startup."; - }; - - dataDir = mkOption { - type = types.path; - default = "/var/lib/ollama"; - description = "Directory to store Ollama data."; - }; - }; - }; - - config = mkIf cfg.enable { - # users.users.ollama = { - # name = "ollama"; - # uid = 601; - # gid = config.users.groups.ollama.gid; - # home = cfg.dataDir; - # createHome = true; - # description = "Ollama service user"; - # }; - # - # users.groups.ollama = { - # name = "ollama"; - # gid = 602; - # }; - - launchd.daemons.ollama = { - path = [cfg.package]; - command = "${cfg.package}/bin/ollama serve"; - serviceConfig = { - Label = "com.ollama.service"; - # ProgramArguments = ["serve"]; - # WorkingDirectory = cfg.dataDir; - EnvironmentVariables = - { - OLLAMA_HOST = cfg.host; - OLLAMA_PORT = toString cfg.port; - } - // cfg.environmentVariables; - RunAtLoad = true; - KeepAlive = true; - # StandardOutPath = "/var/log/ollama.log"; - # StandardErrorPath = "/var/log/ollama.error.log"; - # UserName = "ollama"; - # GroupName = "ollama"; - }; - }; - - # system.activationScripts.preActivation.text = mkIf (cfg.loadModels != []) '' - # # Load Ollama models - # ${concatMapStrings (model: '' - # ${cfg.package}/bin/ollama pull ${model} - # '') - # cfg.loadModels} - # ''; - }; -} diff --git a/modules/default.nix b/modules/default.nix index d7331ba..46fdfbc 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -6,7 +6,6 @@ imports = [ # ./goread.nix # ./hyprpaper.nix - # ./aichat.nix # ./tuifeed.nix # ./ghostty.nix # ./sketchybar.nix diff --git a/nixos/ryu/services/default.nix b/nixos/ryu/services/default.nix index 9fefa7a..eb1791d 100644 --- a/nixos/ryu/services/default.nix +++ b/nixos/ryu/services/default.nix @@ -12,11 +12,9 @@ ./fwupd.nix ./gstreamer.nix ./handoff.nix - ./llama.nix ./minecraft.nix ./monitoring.nix ./mullvad.nix - ./ollama.nix ./openrgb.nix ./openssh.nix ./pipewire.nix diff --git a/nixos/ryu/services/llama.nix b/nixos/ryu/services/llama.nix deleted file mode 100644 index ae1cf18..0000000 --- a/nixos/ryu/services/llama.nix +++ /dev/null @@ -1,8 +0,0 @@ -{pkgs, ...}: { - # services.llama-cpp = { - # enable = true; - # }; - environment.systemPackages = [ - pkgs.llama-cpp - ]; -} diff --git a/nixos/ryu/services/ollama.nix b/nixos/ryu/services/ollama.nix deleted file mode 100644 index 4f537ba..0000000 --- a/nixos/ryu/services/ollama.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ - pkgs, - lib, - config, - device, - ... -}: { - networking.domains.subDomains."ollama.darksailor.dev".a.data = device.tailscaleIp; - - sops = { - secrets."openai/api_key" = {}; - secrets."llama/api_key".owner = config.services.caddy.user; - templates = { - "LLAMA_API_KEY.env".content = '' - LLAMA_API_KEY=${config.sops.placeholder."llama/api_key"} - ''; - }; - }; - services = { - ollama = { - enable = false; - host = "0.0.0.0"; - # loadModels = ["deepseek-r1:7b" "deepseek-r1:14b" "RobinBially/nomic-embed-text-8k" "qwen3:8b" "qwen3:14b"]; - port = 11434; - # acceleration = "cuda"; - environmentVariables = { - OLLAMA_ORIGINS = "*"; - OLLAMA_LLM_LIBRARY = "cuda"; - LD_LIBRARY_PATH = "run/opengl-driver/lib"; - HTTP_PROXY = "https://ollama.darksailor.dev"; - OLLAMA_CONTEXT_LENGTH = "32000"; - OLLAMA_KEEP_ALIVE = "30m"; - }; - package = pkgs.ollama-cuda; - }; - caddy = { - virtualHosts."ollama.darksailor.dev".extraConfig = '' - import cloudflare - @apikey { - header Authorization "Bearer {env.LLAMA_API_KEY}" - } - - handle @apikey { - header { - # Set response headers or proxy to a different service if API key is valid - Access-Control-Allow-Origin * - -Authorization "Bearer {env.LLAMA_API_KEY}" # Remove the header after validation - } - reverse_proxy localhost:${builtins.toString config.services.ollama.port} - } - - respond "Unauthorized" 403 - ''; - }; - }; - systemd.services.caddy = { - serviceConfig = { - EnvironmentFile = config.sops.templates."LLAMA_API_KEY.env".path; - }; - }; -} diff --git a/nixos/tako/services/default.nix b/nixos/tako/services/default.nix index 95d44e0..a668e24 100644 --- a/nixos/tako/services/default.nix +++ b/nixos/tako/services/default.nix @@ -25,7 +25,6 @@ ./immich.nix ./kellnr.nix ./komga.nix - # ./llms.nix ./matrix ./monitoring.nix ./octodns.nix diff --git a/nixos/tako/services/glance.nix b/nixos/tako/services/glance.nix index 55a9104..d91299e 100644 --- a/nixos/tako/services/glance.nix +++ b/nixos/tako/services/glance.nix @@ -58,12 +58,6 @@ in { icon = "di:navidrome"; alt-status-codes = [401]; } - { - title = "OpenWebUI"; - url = "https://chat.darksailor.dev"; - icon = "di:open-webui"; - alt-status-codes = [401]; - } { title = "Prowlarr"; url = "https://prowlarr.darksailor.dev"; diff --git a/nixos/tako/services/llms.nix b/nixos/tako/services/llms.nix deleted file mode 100644 index a14806d..0000000 --- a/nixos/tako/services/llms.nix +++ /dev/null @@ -1,56 +0,0 @@ -{config, ...}: { - networking.domains.subDomains."chat.darksailor.dev" = {}; - - sops = { - secrets."llama/api_key".owner = config.services.caddy.user; - secrets."openai/api_key" = {}; - templates = { - "ollama.env".content = '' - LLAMA_API_KEY=${config.sops.placeholder."llama/api_key"} - OPENAI_API_KEYS=${config.sops.placeholder."openai/api_key"} - ''; - }; - }; - services = { - open-webui = { - enable = true; - port = 7070; - environment = { - SCARF_NO_ANALYTICS = "True"; - DO_NOT_TRACK = "True"; - ANONYMIZED_TELEMETRY = "False"; - WEBUI_AUTH = "False"; - ENABLE_LOGIN_FORM = "False"; - WEBUI_URL = "https://chat.darksailor.dev"; - OLLAMA_BASE_URL = "https://ollama.darksailor.dev"; - }; - environmentFile = "${config.sops.templates."ollama.env".path}"; - }; - - caddy = { - virtualHosts."chat.darksailor.dev".extraConfig = '' - import auth - reverse_proxy localhost:${builtins.toString config.services.open-webui.port} - ''; - }; - authelia = { - instances.darksailor = { - settings = { - access_control = { - rules = [ - { - domain = "chat.darksailor.dev"; - policy = "one_factor"; - } - ]; - }; - }; - }; - }; - }; - systemd.services.caddy = { - serviceConfig = { - EnvironmentFile = config.sops.templates."ollama.env".path; - }; - }; -} diff --git a/scripts/prepare-commit-msg b/scripts/prepare-commit-msg deleted file mode 100755 index e2f54cc..0000000 --- a/scripts/prepare-commit-msg +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -COMMIT_MSG_FILE=$1 -COMMIT_SOURCE=$2 -SHA1=$3 - -if [[ -z "$COMMIT_SOURCE" ]] -then - DIFF_OUTPUT=$(git diff --cached) - AI_CHAT_OUTPUT=$(echo "$DIFF_OUTPUT" | aichat --role git-commit) - CURRENT_MSG=$(cat "$COMMIT_MSG_FILE") - - { - echo "$AI_CHAT_OUTPUT" - echo - echo "$CURRENT_MSG" - } > "$COMMIT_MSG_FILE" -fi