https://github.com/josh/ollama-models-nix
Ollama models via Nix
https://github.com/josh/ollama-models-nix
nix ollama
Last synced: 12 months ago
JSON representation
Ollama models via Nix
- Host: GitHub
- URL: https://github.com/josh/ollama-models-nix
- Owner: josh
- License: mit
- Created: 2024-12-09T21:33:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-13T19:04:48.000Z (about 1 year ago)
- Last Synced: 2025-07-13T21:18:17.068Z (about 1 year ago)
- Topics: nix, ollama
- Language: Nix
- Homepage:
- Size: 481 KB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ollama-models-nix
An `ollama` already exists upstream in nixpkgs. This repository provides locked models from the [Ollama registry](https://ollama.com/search) that can be used with the `OLLAMA_MODELS` environment variable. Models will be loaded from you Nix store rather than lazily downloaded.
## Usage
```sh
export OLLAMA_MODELS=$(nix build --print-out-paths github:josh/ollama-models-nix#llama3_2.3b)
ollama serve
```
Multiple models can easily be merged into a single directory using [nixpkgs](https://github.com/NixOS/nixpkgs) `symlinkJoin`.
```nix
let
ollama-models-flake = builtins.getFlake "github:josh/ollama-models-nix";
pkgs = import {
overlays = [ ollama-models-flake.overlays.default ];
};
in
pkgs.symlinkJoin {
name = "ollama-models";
paths = with pkgs.ollama-models; [ llama3_1 llama3_2."3b" ];
}
```
or using by overriding the `ollama-models` package.
```nix
let
ollama-models-flake = builtins.getFlake "github:josh/ollama-models-nix";
pkgs = import {
overlays = [ ollama-models-flake.overlays.default ];
};
in
pkgs.ollama-models.override {
models = [ "llama3.1" "llama3.2:3b" ];
}
```
An `ollama` wrapper can also be generated pre-configured with your models directory.
```nix
let
system = builtins.currentSystem;
ollama-models-flake = builtins.getFlake "github:josh/ollama-models-nix";
in
ollama-models-flake.packages.${system}.ollama.override {
models = [ "llama3.1" "llama3.2:3b" ];
}
```