Files
dotfiles/system-modules/ollama.nix
Lennart J. Kurzweg (Nx2) 2db49fe4c6 helix ++ + llm.nx2.site trying
2024-05-08 02:13:08 +02:00

44 lines
1.1 KiB
Nix
Executable File

{ config, pkgs, lib, system, user, host, allowed, secrets, ... }:
{
environment.systemPackages = with pkgs; [
ollama
];
services.ollama.environmentVariables = {
OLLAMA_ORIGINS = "*";
};
systemd.services.ollama = {
environment.OLLAMA_ORIGINS = "*";
description = "Ollama Service";
after = [ "network-online.target" "ollama-doesnt-respect-xdg-data-home.service" ];
serviceConfig = {
Type = "simple";
# Environment = "\"XDG_DATA_HOME=/run/current-system/sw/share\"";
ExecStart = "${pkgs.ollama}/bin/ollama serve";
User = "ollama";
Group = "ollama";
Restart = "always";
RestartSec = "3";
};
wantedBy = [ "default.target" ];
};
users.users.ollama = {
isSystemUser = true;
home = "/usr/share/ollama";
shell = "/bin/false";
group = "ollama";
};
users.groups.ollama = {};
systemd.services.ollama-doesnt-respect-xdg-data-home = {
wantedBy = ["multi-user.target"];
script = ''
mkdir -p /usr/share/ollama/.ollama
chown ollama:ollama -R /usr/share/ollama
'';
};
}