make ollama into a module

This commit is contained in:
Osman Faruk Bayram 2025-03-04 21:39:18 +03:00
parent 60ba5895d3
commit 7d219d06e1
3 changed files with 42 additions and 19 deletions

View file

@ -26,6 +26,7 @@
enableSound = true;
enableADB = true;
# enableCaddy = true;
enableOllama = true;
};
# Bootloader.
@ -96,25 +97,6 @@
nixd
];
services.ollama = {
enable = true;
acceleration = "cuda";
loadModels = ["deepseek-r1:7b" "deepseek-r1:14b"];
};
services.open-webui = {
enable = true;
port = 7070;
host = "0.0.0.0";
openFirewall = true;
environment = {
SCARF_NO_ANALYTICS = "True";
DO_NOT_TRACK = "True";
ANONYMIZED_TELEMETRY = "False";
WEBUI_AUTH = "False";
ENABLE_LOGIN_FORM = "False";
};
};
system.stateVersion = "25.05"; # great taboo of the nixos world
}

View file

@ -13,6 +13,7 @@
./i18n.nix
./jellyfin.nix
./nix-settings.nix
./ollama.nix
./remote-builds.nix
./secrets.nix
./sound.nix

40
modules/ollama.nix Normal file
View file

@ -0,0 +1,40 @@
{
lib,
config,
...
}: {
options = {
myModules = {
enableOllama = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable Ollama services.";
};
};
};
config = lib.mkMerge [
(lib.mkIf config.myModules.enableOllama {
services.ollama = {
enable = true;
acceleration = "cuda";
loadModels = ["deepseek-r1:7b" "deepseek-r1:14b"];
};
services.open-webui = {
enable = true;
port = 7070;
host = "0.0.0.0";
openFirewall = true;
environment = {
SCARF_NO_ANALYTICS = "True";
DO_NOT_TRACK = "True";
ANONYMIZED_TELEMETRY = "False";
WEBUI_AUTH = "False";
ENABLE_LOGIN_FORM = "False";
};
};
})
];
}