fix ollama for hass
This commit is contained in:
@@ -75,6 +75,8 @@ in
|
||||
|
||||
open-webui.enable = true;
|
||||
|
||||
ollama.enable = true;
|
||||
|
||||
orca-slicer.enable = true;
|
||||
|
||||
vscode.enable = true;
|
||||
|
||||
@@ -13,28 +13,21 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
systemd.services.ollama-docker = {
|
||||
path = [
|
||||
pkgs.bash
|
||||
pkgs.docker
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
autoStart = true;
|
||||
image = cfg.image;
|
||||
extraOptions = [ "--device=nvidia.com/gpu=0" ];
|
||||
volumes = [
|
||||
"${cfg.configPath}:/root/.ollama"
|
||||
];
|
||||
script = ''
|
||||
set -e
|
||||
exec docker run \
|
||||
--rm \
|
||||
--gpus all \
|
||||
--runtime=nvidia \
|
||||
--name=${cfg.name} \
|
||||
-e PUID=${cfg.puid} \
|
||||
-e PGID=${cfg.pgid} \
|
||||
-e TZ=${cfg.timeZone} \
|
||||
-e 'NVIDIA_DRIVER_CAPABILITIES'='all' \
|
||||
-e 'NVIDIA_VISIBLE_DEVICES'='all' \
|
||||
-p ${cfg.port}:11434 \
|
||||
-v '${cfg.configPath}:/root/.ollama' \
|
||||
${cfg.image}:latest
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
ports = [ "${cfg.port}:11434" ];
|
||||
environment = {
|
||||
NVIDIA_VISIBLE_DEVICES = "all";
|
||||
NVIDIA_DRIVER_CAPABILITIES = "all";
|
||||
PUID = cfg.puid;
|
||||
PGID = cfg.pgid;
|
||||
TZ = cfg.timeZone;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user