- 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
44 lines
877 B
Nix
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};
|
|
'';
|
|
};
|
|
};
|
|
}
|