···
The home directory that the ollama service is started in.
25
+
See also `services.ollama.writablePaths` and `services.ollama.sandbox`.
···
example = "/path/to/ollama/models";
The directory that the ollama service will read models from and download new models to.
35
+
See also `services.ollama.writablePaths` and `services.ollama.sandbox`
36
+
if downloading models or other mutation of the filesystem is required.
39
+
sandbox = lib.mkOption {
44
+
Whether to enable systemd's sandboxing capabilities.
46
+
This sets [`DynamicUser`](
47
+
https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#DynamicUser=
48
+
), which runs the server as a unique user with read-only access to most of the filesystem.
50
+
See also `services.ollama.writablePaths`.
53
+
writablePaths = lib.mkOption {
54
+
type = types.listOf types.str;
56
+
example = [ "/home/foo" "/mnt/foo" ];
58
+
Paths that the server should have write access to.
60
+
This sets [`ReadWritePaths`](
61
+
https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#ReadWritePaths=
62
+
), which allows specified paths to be written to through the default sandboxing.
64
+
See also `services.ollama.sandbox`.
listenAddress = lib.mkOption {
···
type = types.attrsOf types.str;
OLLAMA_LLM_LIBRARY = "cpu";
96
+
HIP_VISIBLE_DEVICES = "0,1";
Set arbitrary environment variables for the ollama service.
···
ExecStart = "${lib.getExe ollamaPackage} serve";
WorkingDirectory = cfg.home;
StateDirectory = [ "ollama" ];
123
+
DynamicUser = cfg.sandbox;
124
+
ReadWritePaths = cfg.writablePaths;