alexandria: serve opencode web at ai.baduhai.dev

This commit is contained in:
William 2026-04-17 22:50:43 -03:00
parent 6105247c72
commit d1df81bf71
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,31 @@
{ inputs, pkgs, ... }:
let
mkNginxVHosts = inputs.self.lib.mkNginxVHosts;
opencodePort = 58801;
opencodePackage = inputs.nix-ai-tools.packages.${pkgs.stdenv.hostPlatform.system}.opencode;
in
{
services.nginx.virtualHosts = mkNginxVHosts {
domains = {
"ai.baduhai.dev".locations."/".proxyPass = "http://127.0.0.1:${toString opencodePort}/";
};
};
systemd.services.opencode-web = {
description = "OpenCode Web UI";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "simple";
DynamicUser = true;
StateDirectory = "opencode-web";
WorkingDirectory = "/var/lib/opencode-web";
Environment = "HOME=/var/lib/opencode-web";
ExecStart = "${opencodePackage}/bin/opencode web --hostname 127.0.0.1 --port ${toString opencodePort}";
Restart = "on-failure";
RestartSec = "5s";
};
};
}

View file

@ -43,5 +43,10 @@
domain = "read.baduhai.dev"; domain = "read.baduhai.dev";
host = "alexandria"; host = "alexandria";
} }
{
name = "opencode-web";
domain = "ai.baduhai.dev";
host = "alexandria";
}
]; ];
} }