From 3b466250f40fb168dbadef8f29a3c0c51e9314c1 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 23 Oct 2024 19:24:53 +0300 Subject: [PATCH] Ollama: Make pull wait for network. --- module/Ollama.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/module/Ollama.nix b/module/Ollama.nix index 0a76529..b6cc980 100644 --- a/module/Ollama.nix +++ b/module/Ollama.nix @@ -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} ''; };