Files
nix-config/modules/apps/ollama/default.nix
2024-06-10 09:08:54 -05:00

34 lines
627 B
Nix

{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.nas-apps.ollama;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers.${cfg.name} = {
autoStart = true;
image = cfg.image;
extraOptions = [ "--device=nvidia.com/gpu=0" ];
volumes = [
"${cfg.configPath}:/root/.ollama"
];
ports = [ "${cfg.port}:11434" ];
environment = {
NVIDIA_VISIBLE_DEVICES = "all";
NVIDIA_DRIVER_CAPABILITIES = "all";
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
}