Ollama : Make a system service.

This commit is contained in:
Dmitry Voronin 2024-02-29 09:38:47 +03:00
parent 99ebc1e529
commit 205aa1d24c

View file

@ -1,18 +1,18 @@
{ pkgs, lib, ... }: { { pkgs, lib, ... }: {
environment.systemPackages = with pkgs; [ ollama ]; environment.systemPackages = with pkgs; [ ollama ];
systemd.user.services.ollama = { systemd.services.ollama = {
description = "Ollama LLM server."; description = "Ollama LLM server.";
wantedBy = [ "default.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "NetworkManager-wait-online.service" ]; wants = [ "NetworkManager-wait-online.service" ];
after = [ "NetworkManager-wait-online.service" ]; after = [ "NetworkManager-wait-online.service" ];
serviceConfig.Type = "simple"; serviceConfig.Type = "simple";
script = '' script = ''
${lib.getExe pkgs.ollama} serve HOME=/root ${lib.getExe pkgs.ollama} serve
''; '';
}; };
systemd.user.services.ollamamodel = { systemd.services.ollamamodel = {
description = "Ollama LLM model."; description = "Ollama LLM model.";
wantedBy = [ "default.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "ollama.service" ]; wants = [ "ollama.service" ];
after = [ "ollama.service" ]; after = [ "ollama.service" ];
serviceConfig.Type = "simple"; serviceConfig.Type = "simple";