From 7014a7115579d9537dce78f0f5083006e737fcad Mon Sep 17 00:00:00 2001 From: Paul Grandperrin Date: Fri, 21 Nov 2025 16:10:41 +0100 Subject: [PATCH] nixos/ollama: add vulkan acceleration option --- nixos/modules/services/misc/ollama.nix | 2 ++ nixos/tests/all-tests.nix | 1 + nixos/tests/ollama-vulkan.nix | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 nixos/tests/ollama-vulkan.nix diff --git a/nixos/modules/services/misc/ollama.nix b/nixos/modules/services/misc/ollama.nix index 6c45952b8ce7..9880da94e5c2 100644 --- a/nixos/modules/services/misc/ollama.nix +++ b/nixos/modules/services/misc/ollama.nix @@ -103,6 +103,7 @@ in false "rocm" "cuda" + "vulkan" ] ); default = null; @@ -119,6 +120,7 @@ in - may require overriding gpu type with `services.ollama.rocmOverrideGfx` if rocm doesn't detect your AMD gpu - `"cuda"`: supported by most modern NVIDIA GPUs + - `"vulkan"`: supported by most modern GPUs on Linux ''; }; rocmOverrideGfx = lib.mkOption { diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index ac16eaf315a7..c2044981638b 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1136,6 +1136,7 @@ in ollama = runTest ./ollama.nix; ollama-cuda = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./ollama-cuda.nix; ollama-rocm = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./ollama-rocm.nix; + ollama-vulkan = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./ollama-vulkan.nix; ombi = runTest ./ombi.nix; omnom = runTest ./omnom; oncall = runTest ./web-apps/oncall.nix; diff --git a/nixos/tests/ollama-vulkan.nix b/nixos/tests/ollama-vulkan.nix new file mode 100644 index 000000000000..c4f210ad26c8 --- /dev/null +++ b/nixos/tests/ollama-vulkan.nix @@ -0,0 +1,17 @@ +{ lib, ... }: +{ + name = "ollama-vulkan"; + meta.maintainers = with lib.maintainers; [ abysssol ]; + + nodes.vulkan = + { ... }: + { + services.ollama.enable = true; + services.ollama.acceleration = "vulkan"; + }; + + testScript = '' + vulkan.wait_for_unit("multi-user.target") + vulkan.wait_for_open_port(11434) + ''; +}