Commit graph

29 commits

Author SHA1 Message Date
Thiago Kenji Okada 5bdecea140 nixos/ollama: add network-online.target to ollama-model-loader.service
This should avoid the service failing to start after switching to a new
configuration because the network service was restarted.
2025-09-16 10:17:14 +01:00
a 1d483cbef1 Resolves #405846 2025-05-10 21:38:58 +12:00
dish 32579269a4 nixos/ollama: fix documentation link formatting 2025-02-12 21:03:21 +01:00
abysssol 04d175b54a nixos/ollama: add allowed device for WSL compatibility 2024-12-12 13:06:43 +07:00
abysssol 4b417eb22b nixos/ollama: fix rocmOverrideGfx description
Updated example to one that works, based on this comment:
https://github.com/NixOS/nixpkgs/issues/333123#issuecomment-2310706898
2024-08-27 08:13:37 -04:00
abysssol 5f17f87a7f nixos/ollama: move loadModels script into a separate service
Due to the large size of models, the script can run for a long time,
which can cause timeouts, since the startup phase has a time limit.
2024-08-16 11:36:35 -04:00
Víctor Martínez bbb542ea66
nixos/ollama: add missing nvidia device group name (#331125)
Fixes: #331069
2024-07-30 19:03:08 +02:00
abysssol 084f6a3e26 nixos/ollama: make rocmOverrideGfx backward compatible
The initial version of `rocmOverrideGfx` incorrectly used `lib.mkIf`
in an attempt to prevent interference with previous uses of
`environmentVariables.HSA_OVERRIDE_GFX_VERSION`.

However, the effect was actually to simply erase existing definitions of
`HSA_OVERRIDE_GFX_VERSION` until `rocmOverrideGfx` was set,
which was the situation I was trying to avoid in the first place.

This fixes the bug by switching from `lib.mkIf` to `lib.optionalAttrs`.
2024-07-24 16:11:09 -04:00
abysssol 246d1ee533 nixos/ollama: reformat with nixfmt-rfc-style 2024-07-24 16:09:56 -04:00
Martin Weinelt fe58e8856f
nixos/ollama: make host example dualstack wildcard
Binding to IPv6 wildcard generally binds dual-stack, which is also a
better example because the way to specify it is not always very clear.
2024-07-22 14:51:40 +02:00
Martin Weinelt 12897b37a8
nixos/ollama: harden systemd unit
Tested with CPU and CUDA acceleration. Researched for ROCm, but I have no
compatible card to test it with.
2024-07-22 14:51:40 +02:00
Martin Weinelt be7bce879f
nixos/ollama: remove writablePaths option
Making the models directory always writable is much simpler, than having
to watch out for an option to facilitate that.
2024-07-22 14:51:39 +02:00
Martin Weinelt 809ea5c6bd
nixos/ollama: replace flawed sandboxing option
The ollama module in its default configuration relies on systemd's
`DynamicUser=` feature for user allocation. In #305076 that allocation
was made conditional and tied to the `sandboxing` option, that was
intended to fix access to model directories outside the allocated state
directory.

However, by disabling sandboxing ollama would inadvertently run as root,
given that `User=` and `Group=` are not required to be set.

The correct way to grant access to other paths is to allocate static
user and group, and grant permissions to the destination path to that
allocation.

We therefore replace the sandboxing option user and group options, that
default to `null`, which means they default to `DynamicUser=`, but can
be replaced with a statically allocated user/group, and thereby a stable
uid/gid.

Fixes: 552eb759 ("nixos/ollama: add options to bypass sandboxing")
2024-07-22 14:51:39 +02:00
abysssol bf91b72c06 nixos/ollama: remove linuxPackages override
`linuxPackages.nvidia_x11` is no longer used by the `ollama` package.
2024-07-01 04:50:19 -04:00
Pol Dellaiera f6727a9e3e nixos/ollama: add loadModels config option
Allows users to download model files upon service startup,
instead of at the first use of the model, improving percieved startup latency.
2024-06-26 15:11:37 -04:00
abysssol 42c70e2923 nixos/ollama: add option for HSA_OVERRIDE_GFX_VERSION
There are several GPUs that ROCm doesn't officially support but
will work correctly if ROCm is directed to treat the GPU as a different
one that is supported and has a similar architecture.
This can be done by setting `HSA_OVERRIDE_GFX_VERSION`.
Ollama has documentation on this topic: https://github.com/ollama/ollama/blob/main/docs/gpu.md#amd-radeon
2024-06-22 13:13:08 -04:00
Pol Dellaiera c54890e226
nixos/ollama: update port option, use types.port 2024-06-05 08:05:18 +02:00
Pol Dellaiera cb8670469b
nixos/ollama: add openFirewall option 2024-06-05 07:09:13 +02:00
abysssol 428e60cad9 nixos/ollama: split listenAddress into host and port
breaking change; do not backport
2024-05-25 21:22:15 -04:00
abysssol 552eb75964 nixos/ollama: add options to bypass sandboxing 2024-04-18 10:52:20 -04:00
abysssol f53ced0368 nixos/ollama: set service working directory to home 2024-04-17 03:07:00 -04:00
abysssol 4508b59900 nixos/ollama: update documentation 2024-04-13 19:52:08 -04:00
abysssol 18a5476aa7 nixos/ollama: add options to override HOME and OLLAMA_MODELS 2024-04-07 22:56:43 -04:00
abysssol b5e7a05bb7 nixos/ollama: add option to set environment variables 2024-03-14 04:21:36 -04:00
abysssol 8720397720 nixos/ollama: replace incorrect use of overrideAttrs
The bug prevents nixos from compiling
if the ollama service is built with cuda enabled.
2024-02-28 17:15:30 -05:00
abysssol 5c143f0366 nixos/ollama: override kernelPackages with nvidia driver
Instead of setting linuxPackages to a singleton set with nvidia_x11,
override the system's kernelPackages with the nvidia driver.
This is more semantically correct, though doesn't change any behavior.
2024-02-27 18:51:54 -05:00
abysssol b8d8c1f207 nixos/ollama: add option for hardware acceleration 2024-02-25 15:57:58 -05:00
Marcus Ramberg 8d956b1725 nixos/ollama: Add listenAddress 2024-01-21 00:27:07 +01:00
Jonas Heinrich 67a799c40f nixos/ollama: init 2023-12-29 15:19:55 +01:00