mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 13:43:56 -05:00
36 lines
891 B
Nix
36 lines
891 B
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: {
|
|
options = {
|
|
alyraffauf.services.ollama = {
|
|
enable = lib.mkEnableOption "Enable ollama interface for LLMs.";
|
|
listenAddress = lib.mkOption {
|
|
description = "Listen Address for Ollama.";
|
|
default = "127.0.0.1:11434";
|
|
type = lib.types.str;
|
|
};
|
|
gpu = lib.mkOption {
|
|
description = "Type of GPU for enabling GPU acceleration.";
|
|
default = null;
|
|
type = lib.types.str;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.alyraffauf.services.ollama.enable {
|
|
services.ollama = {
|
|
enable = true;
|
|
acceleration =
|
|
if config.alyraffauf.services.ollama.gpu == "amd"
|
|
then "rocm"
|
|
else if config.alyraffauf.services.ollama.gpu == "nvidia"
|
|
then "cuda"
|
|
else null;
|
|
listenAddress = config.alyraffauf.services.ollama.listenAddress;
|
|
};
|
|
};
|
|
}
|