wip: ollama support?
This commit is contained in:
parent
8036d54fcd
commit
303cec1b3c
@ -44,6 +44,10 @@ in
|
|||||||
# };
|
# };
|
||||||
#};
|
#};
|
||||||
|
|
||||||
|
services.ollama = {
|
||||||
|
enable = true;
|
||||||
|
user="zaphar";
|
||||||
|
};
|
||||||
services.my-lorri.enable = true;
|
services.my-lorri.enable = true;
|
||||||
services.durnitisp.enable = true;
|
services.durnitisp.enable = true;
|
||||||
services.node-exporter.enable = true;
|
services.node-exporter.enable = true;
|
||||||
|
@ -369,6 +369,8 @@ EOF";
|
|||||||
victoriametrics
|
victoriametrics
|
||||||
# TODO add sonic-pi here if it supports the arch
|
# TODO add sonic-pi here if it supports the arch
|
||||||
unstablePkgs.dbeaver-bin
|
unstablePkgs.dbeaver-bin
|
||||||
|
postgresql
|
||||||
|
unstablePkgs.ollama
|
||||||
])
|
])
|
||||||
#++ (with pkgs.ocamlPackages; [
|
#++ (with pkgs.ocamlPackages; [
|
||||||
# dune_3
|
# dune_3
|
||||||
@ -397,6 +399,7 @@ EOF";
|
|||||||
./modules/victoria-logs.nix
|
./modules/victoria-logs.nix
|
||||||
./modules/vector.nix
|
./modules/vector.nix
|
||||||
./modules/lorri.nix
|
./modules/lorri.nix
|
||||||
|
./modules/ollama.nix
|
||||||
./darwin-configuration.nix
|
./darwin-configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
59
nix/base-system/modules/ollama.nix
Normal file
59
nix/base-system/modules/ollama.nix
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{pkgs, lib, config, ...}:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
mkLauncher = import ../../packages/darwin-launcher.nix { inherit pkgs; };
|
||||||
|
ollamaLauncher = mkLauncher ''
|
||||||
|
exec ${pkgs.clio}/bin/clio \
|
||||||
|
--out-path=${config.services.ollama.stdoutPath} \
|
||||||
|
--err-path=${config.services.ollama.stdoutPath} \
|
||||||
|
--pid-file=${config.services.ollama.pidPath} \
|
||||||
|
--paranoid \
|
||||||
|
-- \
|
||||||
|
${pkgs.ollama}/bin/ollama \
|
||||||
|
serve
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.ollama = {
|
||||||
|
enable = mkEnableOption "Enable the ollama agent";
|
||||||
|
stdoutPath = mkOption {
|
||||||
|
default = "/var/log/ollama.out.log";
|
||||||
|
};
|
||||||
|
stderrPath = mkOption {
|
||||||
|
default = "/var/log/ollama.err.log";
|
||||||
|
};
|
||||||
|
pidPath = mkOption {
|
||||||
|
default = "/var/log/ollama.pid";
|
||||||
|
};
|
||||||
|
user = mkOption {
|
||||||
|
default="zaphar";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
launchd.user.agents.ollama = mkIf config.services.ollama.enable {
|
||||||
|
serviceConfig = {
|
||||||
|
ProgramArguments = [
|
||||||
|
"${ollamaLauncher}"
|
||||||
|
];
|
||||||
|
WatchPaths= [
|
||||||
|
"/etc/${config.environment.etc."ollama.yaml".target}"
|
||||||
|
];
|
||||||
|
EnvironmentVariables = {
|
||||||
|
"OLLAMA_HOST" = "127.0.0.1:11434";
|
||||||
|
"OLLAMA_MODELS" = "/Users/${config.services.ollama.user}/config/ollama";
|
||||||
|
};
|
||||||
|
RunAtLoad = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."newsyslog.d/org.nixos.ollama.conf" = mkIf config.services.ollama.enable {
|
||||||
|
text = ''
|
||||||
|
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
|
||||||
|
${config.services.ollama.stdoutPath} zaphar:staff 644 10 1000 * BJ ${config.services.ollama.pidPath} 1
|
||||||
|
${config.services.ollama.stderrPath} zaphar:staff 644 10 1000 * BJ ${config.services.ollama.pidPath} 1
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user