34 lines
843 B
Nix
34 lines
843 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib; let
|
|
cfg = config.extraServices.ollama;
|
|
in {
|
|
options.extraServices.ollama.enable = mkEnableOption "enable ollama";
|
|
|
|
config = mkIf cfg.enable {
|
|
services.ollama = {
|
|
enable = true;
|
|
package =
|
|
if config.services.xserver.videoDrivers == ["amdgpu"] # rocblas-6.0.2 broken
|
|
then pkgs.pinned.ollama
|
|
else pkgs.ollama;
|
|
acceleration =
|
|
if config.services.xserver.videoDrivers == ["amdgpu"]
|
|
then "rocm"
|
|
else if config.services.xserver.videoDrivers == ["nvidia"]
|
|
then "cuda"
|
|
else null;
|
|
host = "[::]";
|
|
openFirewall = true;
|
|
};
|
|
nixpkgs.config = {
|
|
rocmSupport = config.services.xserver.videoDrivers == ["amdgpu"];
|
|
cudaSupport = config.services.xserver.videoDrivers == ["nvidia"];
|
|
};
|
|
};
|
|
}
|