nixos/ollama: update port option, use types.port

This commit is contained in:
Pol Dellaiera
2024-06-05 08:05:18 +02:00
parent cb8670469b
commit c54890e226
+3 -7
View File
@@ -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";