From 47bdbc8bf2ad800977def3fa611e76818f8f2325 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Wed, 20 Aug 2025 16:02:20 +0530 Subject: [PATCH] feat: add caddy and lmstudio services to shiro configuration --- darwin/kuro/homebrew.nix | 1 + darwin/kuro/services/default.nix | 2 +- darwin/shiro/services/caddy.nix | 42 ++++++++++++++++++++++++++ darwin/shiro/services/default.nix | 2 ++ darwin/shiro/services/lmstudio.nix | 8 +++++ home/programs/aichat.nix | 15 +++++++-- modules/{macos => darwin}/jellyfin.nix | 0 modules/{macos => darwin}/ollama.nix | 0 8 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 darwin/shiro/services/caddy.nix create mode 100644 darwin/shiro/services/lmstudio.nix rename modules/{macos => darwin}/jellyfin.nix (100%) rename modules/{macos => darwin}/ollama.nix (100%) diff --git a/darwin/kuro/homebrew.nix b/darwin/kuro/homebrew.nix index 6590eaea..423b6db6 100644 --- a/darwin/kuro/homebrew.nix +++ b/darwin/kuro/homebrew.nix @@ -13,6 +13,7 @@ "vlc" "zed" "zen" + "lmstudio" ]; }; } diff --git a/darwin/kuro/services/default.nix b/darwin/kuro/services/default.nix index 7d444c74..9a7c4045 100644 --- a/darwin/kuro/services/default.nix +++ b/darwin/kuro/services/default.nix @@ -3,7 +3,7 @@ ./yabai.nix ./skhd.nix ./tailscale.nix - ./ollama.nix + # ./ollama.nix # ./aerospace.nix ]; } diff --git a/darwin/shiro/services/caddy.nix b/darwin/shiro/services/caddy.nix new file mode 100644 index 00000000..2138f50f --- /dev/null +++ b/darwin/shiro/services/caddy.nix @@ -0,0 +1,42 @@ +{ + config, + pkgs, + ... +}: { + sops = { + secrets."hetzner/api_key".owner = config.services.caddy.user; + templates = { + "HETZNER_API_KEY.env".content = '' + HETZNER_API_KEY=${config.sops.placeholder."hetzner/api_key"} + ''; + }; + }; + services = { + caddy = { + enable = true; + extraConfig = '' + (hetzner) { + tls { + propagation_timeout -1 + propagation_delay 120s + dns hetzner {env.HETZNER_API_KEY} + resolvers 1.1.1.1 + } + } + ''; + package = pkgs.caddy.withPlugins { + plugins = ["github.com/caddy-dns/hetzner@v1.0.0"]; + # hash = "sha256-9ea0CfOHG7JhejB73HjfXQpnonn+ZRBqLNz1fFRkcDQ="; + # hash = "sha256-9ea0CfOHG7JhejB73HjfXQpnonn+ZRBqLNz1fFRkcDQ=" + hash = "sha256-YUrprDZQL+cX3P8fVLKHouXTMG4rw3sCaQdGqiq37uA="; + }; + }; + }; + systemd.services.caddy = { + serviceConfig = { + EnvironmentFile = config.sops.templates."HETZNER_API_KEY.env".path; + Requires = ["sops.service"]; + After = ["sops.service"]; + }; + }; +} diff --git a/darwin/shiro/services/default.nix b/darwin/shiro/services/default.nix index b613f45d..272f0482 100644 --- a/darwin/shiro/services/default.nix +++ b/darwin/shiro/services/default.nix @@ -4,6 +4,8 @@ ./skhd.nix ./tailscale.nix ./autossh.nix + # ./caddy.nix + # ./lmstudio.nix # ./colima.nix # ./zerotier.nix # ./aerospace.nix diff --git a/darwin/shiro/services/lmstudio.nix b/darwin/shiro/services/lmstudio.nix new file mode 100644 index 00000000..7dc4ad56 --- /dev/null +++ b/darwin/shiro/services/lmstudio.nix @@ -0,0 +1,8 @@ +{...}: { + services = { + caddy.virtualHosts."lmstudio.shiro.darksailor.dev" = '' + import hetzner + reverse_proxy localhost:1234 + ''; + }; +} diff --git a/home/programs/aichat.nix b/home/programs/aichat.nix index c6c2c1e2..5c0bcc57 100644 --- a/home/programs/aichat.nix +++ b/home/programs/aichat.nix @@ -105,8 +105,19 @@ } { type = "openai-compatible"; - name = "LMStudio"; - api_base = "http://localhost:1234/v1"; + 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"; diff --git a/modules/macos/jellyfin.nix b/modules/darwin/jellyfin.nix similarity index 100% rename from modules/macos/jellyfin.nix rename to modules/darwin/jellyfin.nix diff --git a/modules/macos/ollama.nix b/modules/darwin/ollama.nix similarity index 100% rename from modules/macos/ollama.nix rename to modules/darwin/ollama.nix