nixos/hosts/architect/llm.nix
Giulio De Pasquale 2b17b0b463 refactor(architect/llm.nix): simplify and clean up configuration
- Removed unused frontend domain, port, and listen address variables
- Centralized `ollamaHost` and `ollamaPort` usage
- Cleaned up commented-out sections for future reference or removal
- Ensured consistent placement of `acceleration` in the `services.ollama` block
2024-11-18 19:56:48 +00:00

44 lines
877 B
Nix

{ pkgs, ... }:
let
backendDomain = "ollama.giugl.io";
ollamaHost = "127.0.0.1";
ollamaPort = 11434;
ollamaPkg = pkgs.unstablePkgs.ollama;
in
{
environment = {
systemPackages = [ ollamaPkg ];
};
services.ollama = {
enable = true;
package = ollamaPkg;
host = ollamaHost;
port = ollamaPort;
acceleration = "cuda";
environmentVariables = {
OLLAMA_FLASH_ATTENTION = "1";
OLLAMA_NUM_PARALLEL = "2";
};
};
architect.vhost.${backendDomain} = {
dnsInterfaces = [ "tailscale" "lan" ];
locations."/" = {
host = ollamaHost;
port = ollamaPort;
allowLan = true;
allowWAN = true;
recommendedProxySettings = false;
extraConfig = ''
proxy_buffering off;
proxy_read_timeout 600s;
proxy_set_header Host localhost:${toString ollamaPort};
'';
};
};
}