31 lines
800 B
Nix
31 lines
800 B
Nix
{ config, pkgs, ... }:
|
|
{
|
|
environment.systemPackages = with pkgs; [
|
|
ollama
|
|
];
|
|
systemd.services = {
|
|
ollama = {
|
|
description = "Server for local large language models";
|
|
after = ["network-online.target"];
|
|
wantedBy = ["multi-user.target"];
|
|
environment = {
|
|
HOME = "%S/ollama";
|
|
OLLAMA_HOST = "0.0.0.0";
|
|
OLLAMA_MODELS = "%S/ollama/models";
|
|
};
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = "ollama";
|
|
Group = "ollama";
|
|
Restart = "always";
|
|
RestartSec = "3";
|
|
WorkingDirectory = "/var/lib/ollama";
|
|
StateDirectory = [ "ollama" ];
|
|
DynamicUser = true;
|
|
ExecStart = "${pkgs.ollama}/bin/ollama serve";
|
|
};
|
|
};
|
|
};
|
|
networking.firewall.allowedTCPPorts = [ 11434 ];
|
|
}
|