Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

services.ollama.enable

Whether to enable ollama server for local large language models.

Type: boolean

Default:

false

Example:

true

Declared by:

services.ollama.package

The ollama package to use.

Type: package

Default:

pkgs.ollama

Declared by:

services.ollama.acceleration

What interface to use for hardware acceleration.

  • null: default behavior

    • if nixpkgs.config.rocmSupport is enabled, uses "rocm"
    • if nixpkgs.config.cudaSupport is enabled, uses "cuda"
    • otherwise defaults to false
  • false: disable GPU, only use CPU

  • "rocm": supported by most modern AMD GPUs

    • may require overriding gpu type with services.ollama.rocmOverrideGfx if rocm doesn’t detect your AMD gpu
  • "cuda": supported by most modern NVIDIA GPUs

Type: null or one of false, “rocm”, “cuda”

Default:

null

Example:

"rocm"

Declared by:

services.ollama.environmentVariables

Set arbitrary environment variables for the ollama service.

Be aware that these are only seen by the ollama server (systemd service), not normal invocations like ollama run. Since ollama run is mostly a shell around the ollama server, this is usually sufficient.

Type: attribute set of string

Default:

{ }

Example:

{
  HIP_VISIBLE_DEVICES = "0,1";
  OLLAMA_LLM_LIBRARY = "cpu";
}

Declared by:

services.ollama.host

The host address which the ollama server HTTP interface listens to.

Type: string

Default:

"127.0.0.1"

Example:

"[::]"

Declared by:

services.ollama.port

Which port the ollama server listens to.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

11434

Example:

11111

Declared by: