diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index 4d3a9d0..ed2a1a7 100644 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -75,6 +75,8 @@ in open-webui.enable = true; + ollama.enable = true; + orca-slicer.enable = true; vscode.enable = true; diff --git a/modules/apps/ollama/default.nix b/modules/apps/ollama/default.nix index c9bca76..b1e5380 100644 --- a/modules/apps/ollama/default.nix +++ b/modules/apps/ollama/default.nix @@ -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; + }; }; }; }