diff --git a/config/Ollama.nix b/config/Ollama.nix index 3dff178..edac282 100644 --- a/config/Ollama.nix +++ b/config/Ollama.nix @@ -1,7 +1,7 @@ { - pkgsUnstable, - lib, config, + lib, + pkgsUnstable, ... }: let @@ -9,40 +9,12 @@ let in { config = lib.mkIf cfg.enable { - # Specify default model. - environment.variables.OLLAMA_MODEL = cfg.primaryModel; - - systemd.services = { - # Enable Ollama server. - ollama = { - description = "Ollama LLM server"; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "simple"; - }; - script = '' - HOME=/root ${lib.getExe pkgsUnstable.ollama} serve - ''; - }; - - # Download Ollama models. - ollama-pull = { - description = "Ollama LLM model"; - wantedBy = [ "multi-user.target" ]; - serviceConfig.Type = "simple"; - after = [ - "NetworkManager-wait-online.service" - "ollama.service" - ]; - wants = [ - "NetworkManager-wait-online.service" - "ollama.service" - ]; - script = '' - sleep 5 - HOME=/root ${lib.getExe pkgsUnstable.ollama} pull ${lib.concatStringsSep " " cfg.models} - ''; - }; + services.ollama = { + enable = true; + host = "[::1]"; + loadModels = cfg.models; + package = pkgsUnstable.ollama; + # acceleration = false; }; }; } diff --git a/option/Ollama.nix b/option/Ollama.nix index 89e2277..bda3b66 100644 --- a/option/Ollama.nix +++ b/option/Ollama.nix @@ -13,8 +13,9 @@ in default = [ cfg.primaryModel ]; type = with lib.types; listOf str; }; + # REF: https://ollama.com/library primaryModel = lib.mkOption { - default = "llama3.2"; + default = "deepseek-r1"; type = lib.types.str; }; };