docker ollama
This commit is contained in:
@@ -1 +1,39 @@
|
||||
{ ... }: {}
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
options.sysconfig.docker.ollama.enable = with lib; mkOption {
|
||||
type = with types; bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.sysconfig.docker.ollama.enable && config.sysconfig.docker.enable) {
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
ollama
|
||||
];
|
||||
|
||||
virtualisation.oci-containers.containers.ollama = {
|
||||
image = "ollama/ollama:latest";
|
||||
|
||||
# unstable, waiting for 26.05
|
||||
#pull = "newer";
|
||||
|
||||
hostname = "ollama.local";
|
||||
|
||||
ports = [
|
||||
"127.0.0.1:11434:11434"
|
||||
];
|
||||
|
||||
volumes = [
|
||||
"vol_ollama:/root/.ollama"
|
||||
];
|
||||
|
||||
cmd = lib.mkIf config.sysconfig.docker.nvidia [
|
||||
"--device=nvidia.com/gpu=all"
|
||||
];
|
||||
|
||||
environment = {
|
||||
OLLAMA_CONTEXT_LENGTH = lib.mkDefault "16000";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user