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.
This commit is contained in:
abysssol
2024-02-27 18:51:54 -05:00
parent 58b1edd610
commit 5c143f0366
+6 -4
View File
@@ -1,11 +1,13 @@
{ config, lib, pkgs, ... }:
let
inherit (lib.types) nullOr enum;
inherit (lib) types;
cfg = config.services.ollama;
ollamaPackage = cfg.package.override {
inherit (cfg) acceleration;
linuxPackages.nvidia_x11 = config.hardware.nvidia.package;
linuxPackages = config.boot.kernelPackages.overrideAttrs {
nvidia_x11 = config.hardware.nvidia.package;
};
};
in
{
@@ -15,14 +17,14 @@ in
lib.mdDoc "Server for local large language models"
);
listenAddress = lib.mkOption {
type = lib.types.str;
type = types.str;
default = "127.0.0.1:11434";
description = lib.mdDoc ''
Specifies the bind address on which the ollama server HTTP interface listens.
'';
};
acceleration = lib.mkOption {
type = nullOr (enum [ "rocm" "cuda" ]);
type = types.nullOr (types.enum [ "rocm" "cuda" ]);
default = null;
example = "rocm";
description = lib.mdDoc ''