updates
This commit is contained in:
30
modules/apps/ollama/default.nix
Normal file
30
modules/apps/ollama/default.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let cfg = config.nas-apps.ollama;
|
||||
in {
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
systemd.services.ollama-docker = {
|
||||
path = [ pkgs.bash pkgs.docker ];
|
||||
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" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user