ollama: add acceleration option
This commit is contained in:
parent
95827c16fe
commit
dade0fad68
1 changed files with 19 additions and 1 deletions
|
@ -9,6 +9,11 @@ in {
|
||||||
options.custom.services.ollama = {
|
options.custom.services.ollama = {
|
||||||
enable = mkEnableOption "ollama";
|
enable = mkEnableOption "ollama";
|
||||||
|
|
||||||
|
acceleration = mkOption {
|
||||||
|
default = config.custom.full;
|
||||||
|
type = types.bool;
|
||||||
|
};
|
||||||
|
|
||||||
download = mkOption {
|
download = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = with types; nullOr (enum ["low" "medium" "high"]);
|
type = with types; nullOr (enum ["low" "medium" "high"]);
|
||||||
|
@ -20,7 +25,7 @@ in {
|
||||||
then "localhost"
|
then "localhost"
|
||||||
else "mynix";
|
else "mynix";
|
||||||
|
|
||||||
type = with types; str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,6 +35,18 @@ in {
|
||||||
services.ollama = {
|
services.ollama = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
acceleration =
|
||||||
|
if cfg.acceleration
|
||||||
|
then
|
||||||
|
(
|
||||||
|
if config.custom.settings.hardware.gpu == "amd"
|
||||||
|
then "rocm"
|
||||||
|
else if config.custom.settings.hardware.gpu == "nvidia"
|
||||||
|
then "cuda"
|
||||||
|
else null
|
||||||
|
)
|
||||||
|
else false; # CPU
|
||||||
|
|
||||||
# Bind to all interfaces, but only Tailscale can access the closed port
|
# Bind to all interfaces, but only Tailscale can access the closed port
|
||||||
# https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-expose-ollama-on-my-network
|
# https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-expose-ollama-on-my-network
|
||||||
host = "0.0.0.0";
|
host = "0.0.0.0";
|
||||||
|
@ -71,6 +88,7 @@ in {
|
||||||
# https://wiki.nixos.org/wiki/Ollama#AMD_GPU_with_open_source_driver
|
# https://wiki.nixos.org/wiki/Ollama#AMD_GPU_with_open_source_driver
|
||||||
# https://github.com/ollama/ollama/blob/main/docs/gpu.md#overrides
|
# https://github.com/ollama/ollama/blob/main/docs/gpu.md#overrides
|
||||||
#?? nix run nixpkgs#rocmPackages.rocminfo | grep gfx
|
#?? nix run nixpkgs#rocmPackages.rocminfo | grep gfx
|
||||||
|
#?? echo $HSA_OVERRIDE_GFX_VERSION
|
||||||
rocmOverrideGfx = with config.custom.settings.hardware; mkIf (isString rocm) rocm;
|
rocmOverrideGfx = with config.custom.settings.hardware; mkIf (isString rocm) rocm;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue