Commit 5c143f03 authored by abysssol's avatar abysssol
Browse files

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.
parent 58b1edd6
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
{ 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 ''