Visitar URL original
Add ollama service by sagikazarmark · Pull Request #3306 · cachix/devenv · GitHub
Skip to content

Add ollama service - #3306

Merged
domenkozar merged 1 commit into
cachix:mainfrom
sagikazarmark:ollama
Oct 20, 2026
Merged

domenkozar merged 1 commit into
cachix:mainfrom
sagikazarmark:ollama

Conversation

@sagikazarmark

Copy link
Copy Markdown
Contributor

Adds services.ollama, which runs an Ollama server for local large language models. Ported from sagikazarmark/devenv-extras.

{
  services.ollama = {
    enable = true;
    loadModels = [ "qwen3:0.6b" ];
  };
}

What it does

  • Runs ollama serve as a process with a port assigned by devenv (base port 11434). The process counts as ready once GET /api/version responds.
  • Exports OLLAMA_HOST so the ollama CLI talks to the managed server, and OLLAMA_BASE_URL (http://…/v1) for OpenAI-compatible clients. If the server binds to 0.0.0.0 or ::, clients connect through 127.0.0.1.
  • Stores models in .devenv/state/ollama/models by default. Set modelsDir to a shared directory such as ~/.ollama/models to reuse models across projects.
  • If loadModels is set, a devenv:ollama:load-models task pulls those models after the server is ready and skips any that are already present. devenv up ollama runs the task too. On devenv CLIs older than 2.3.2 the module still evaluates, but models aren't pulled automatically.

Options

Option Default Description
enable false Enable the Ollama server
package pkgs.ollama Use ollama-cuda, ollama-rocm or ollama-vulkan for GPU support on Linux. On macOS, pkgs.ollama uses Metal.
host 127.0.0.1 Bind address. Put IPv6 addresses in brackets.
port 11434 Base port. devenv may assign a different one.
modelsDir ${config.devenv.state}/ollama/models Where models are stored
loadModels [ ] Models to pull once the server is ready
environmentVariables { } Extra env vars for ollama serve, e.g. OLLAMA_KEEP_ALIVE

Changes

  • src/modules/services/ollama.nix: the new module
  • tests/ollama/: integration test that checks /api/version, /v1/models, ollama list and that the models directory is created
  • Docs: generated options data and the service page, plus an Ollama entry with the Simple Icons logo in the technology registry

Testing

  • devenv-run-tests run tests --only ollama passes on Linux.
  • devenv tasks list with loadModels set and host = "0.0.0.0" shows the expected task order: setup, then the server process, then load-models. OLLAMA_HOST resolves to 127.0.0.1:<port> in that case.
  • Not tested: actually pulling a model (the test leaves it out because it needs the network and is slow), macOS, and the GPU packages.

@domenkozar
domenkozar merged commit 0204136 into cachix:main Oct 20, 2026
82 of 84 checks passed
@sagikazarmark
sagikazarmark deleted the ollama branch October 21, 2026 09:08
sagikazarmark added a commit to sagikazarmark/devenv that referenced this pull request Oct 21, 2026
The ollama service (cachix#3306) and tailwindcss language each added a
technology registry entry without updating the hardcoded counts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants