3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #282339 from marcusramberg/marcus/ollama_listen

nixos/ollama: Add listenAddress
This commit is contained in:
Jonas Heinrich 2024-01-21 12:57:53 +01:00 committed by GitHub
commit 58fcc2db9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,13 @@ in {
enable = lib.mkEnableOption ( enable = lib.mkEnableOption (
lib.mdDoc "Server for local large language models" lib.mdDoc "Server for local large language models"
); );
listenAddress = lib.mkOption {
type = lib.types.str;
default = "127.0.0.1:11434";
description = lib.mdDoc ''
Specifies the bind address on which the ollama server HTTP interface listens.
'';
};
package = lib.mkPackageOption pkgs "ollama" { }; package = lib.mkPackageOption pkgs "ollama" { };
}; };
}; };
@ -23,6 +30,7 @@ in {
environment = { environment = {
HOME = "%S/ollama"; HOME = "%S/ollama";
OLLAMA_MODELS = "%S/ollama/models"; OLLAMA_MODELS = "%S/ollama/models";
OLLAMA_HOST = cfg.listenAddress;
}; };
serviceConfig = { serviceConfig = {
ExecStart = "${lib.getExe cfg.package} serve"; ExecStart = "${lib.getExe cfg.package} serve";