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