From aeb538c308333766ffb966f6cca0538e81af2ec5 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Wed, 30 Jul 2025 02:20:40 +0530 Subject: [PATCH] feat: Added resolved to mirai --- home/programs/aichat.nix | 1 - nixos/mirai/services/default.nix | 1 + nixos/mirai/services/llama.nix | 1 + nixos/mirai/services/resolved.nix | 9 +++++++++ nixos/ryu/services/default.nix | 1 + nixos/ryu/services/ollama.nix | 16 ++-------------- 6 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 nixos/mirai/services/resolved.nix diff --git a/home/programs/aichat.nix b/home/programs/aichat.nix index 10c332ad..053cf6b1 100644 --- a/home/programs/aichat.nix +++ b/home/programs/aichat.nix @@ -46,7 +46,6 @@ type = "openai-compatible"; name = "ryu"; api_base = "https://ollama.ryu.darksailor.dev/v1"; - api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}"; models = [ { name = "RobinBially/nomic-embed-text-8k"; diff --git a/nixos/mirai/services/default.nix b/nixos/mirai/services/default.nix index af9c51a4..dc9ba150 100644 --- a/nixos/mirai/services/default.nix +++ b/nixos/mirai/services/default.nix @@ -15,6 +15,7 @@ ./searxng.nix ./immich.nix ./lldap.nix + ./resolved.nix # ./home-assistant.nix # ./jellyfin.nix diff --git a/nixos/mirai/services/llama.nix b/nixos/mirai/services/llama.nix index 39d78f8f..ed18d157 100644 --- a/nixos/mirai/services/llama.nix +++ b/nixos/mirai/services/llama.nix @@ -38,6 +38,7 @@ ENABLE_LOGIN_FORM = "False"; WEBUI_URL = "https://llama.darksailor.dev"; OPENAI_BASE_URL = "https://ollama.darksailor.dev/v1"; + OLLAMA_API_BASE_URL = "https://ollama.ryu.darksailor.dev"; }; environmentFile = "${config.sops.templates."LLAMA_API_KEY.env".path}"; }; diff --git a/nixos/mirai/services/resolved.nix b/nixos/mirai/services/resolved.nix new file mode 100644 index 00000000..e5a1ef14 --- /dev/null +++ b/nixos/mirai/services/resolved.nix @@ -0,0 +1,9 @@ +{...}: { + services.resolved = { + enable = true; + dnssec = "true"; + dnsovertls = "true"; + domains = ["lemur-newton.ts.net"]; + fallbackDns = ["1.1.1.1"]; + }; +} diff --git a/nixos/ryu/services/default.nix b/nixos/ryu/services/default.nix index c5604848..8fedf1fc 100644 --- a/nixos/ryu/services/default.nix +++ b/nixos/ryu/services/default.nix @@ -13,5 +13,6 @@ ./resolved.nix ./minecraft.nix ./fwupd.nix + ./caddy.nix ]; } diff --git a/nixos/ryu/services/ollama.nix b/nixos/ryu/services/ollama.nix index a34eaa7a..81c5b929 100644 --- a/nixos/ryu/services/ollama.nix +++ b/nixos/ryu/services/ollama.nix @@ -14,6 +14,7 @@ environmentVariables = { OLLAMA_LLM_LIBRARY = "cuda"; LD_LIBRARY_PATH = "run/opengl-driver/lib"; + OLLAMA_ORIGINS = "*"; }; }; open-webui = { @@ -35,20 +36,7 @@ ''; virtualHosts."ollama.ryu.darksailor.dev".extraConfig = '' import hetzner - @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 + reverse_proxy localhost:${builtins.toString config.services.ollama.port} ''; }; };