about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2024-06-05 07:13:11 +0200
committerPol Dellaiera <pol.dellaiera@protonmail.com>2024-06-05 08:05:18 +0200
commitc54890e2263658f5f73b11fb451ea35d9bb69ee2 (patch)
tree76ab63f81c567df6db7efad864b19f76a3f06c0e /nixos/modules
parentcb8670469be17ae0a658385de59ee55c3a293faf (diff)
nixos/ollama: update `port` option, use `types.port`
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/misc/ollama.nix10
1 files changed, 3 insertions, 7 deletions
diff --git a/nixos/modules/services/misc/ollama.nix b/nixos/modules/services/misc/ollama.nix
index 47ff201ef7800..886eaa180b9ef 100644
--- a/nixos/modules/services/misc/ollama.nix
+++ b/nixos/modules/services/misc/ollama.nix
@@ -78,11 +78,11 @@ in
         '';
       };
       port = lib.mkOption {
-        type = types.nullOr types.ints.u16;
+        type = types.port;
         default = 11434;
         example = 11111;
         description = ''
-          Which port the ollama server listens to. Set to `null` to not specify a port.
+          Which port the ollama server listens to.
         '';
       };
       acceleration = lib.mkOption {
@@ -135,11 +135,7 @@ in
       environment = cfg.environmentVariables // {
         HOME = cfg.home;
         OLLAMA_MODELS = cfg.models;
-        OLLAMA_HOST =
-          if cfg.port == null then
-            cfg.host
-          else
-            "${cfg.host}:${toString cfg.port}";
+        OLLAMA_HOST = "${cfg.host}:${toString cfg.port}";
       };
       serviceConfig = {
         ExecStart = "${lib.getExe ollamaPackage} serve";