Ollama: Make pull wait for network.

This commit is contained in:
Dmitry Voronin 2024-10-23 19:24:53 +03:00
parent 81d6530047
commit 3b466250f4
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -36,8 +36,6 @@ in
ollama = {
description = "Ollama LLM server.";
wantedBy = [ "multi-user.target" ];
wants = [ "NetworkManager-wait-online.service" ];
after = [ "NetworkManager-wait-online.service" ];
serviceConfig.Type = "simple";
script = ''
HOME=/root ${getExe pkgs.ollama} serve
@ -48,11 +46,16 @@ in
ollama-pull = {
description = "Ollama LLM model.";
wantedBy = [ "multi-user.target" ];
wants = [ "ollama.service" ];
after = [ "ollama.service" ];
wants = [
"NetworkManager-wait-online.service"
"ollama.service"
];
after = [
"NetworkManager-wait-online.service"
"ollama.service"
];
serviceConfig.Type = "simple";
script = ''
sleep 5
${getExe pkgs.ollama} pull ${concatStringsSep " " cfg.models}
'';
};