From 734dacb51e1dde9616208652d9d9a70a927d31e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 Dec 2024 14:29:04 +0100 Subject: marvin: improve colima setup --- user/marvin.nix | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/user/marvin.nix b/user/marvin.nix index 96440985..70593507 100644 --- a/user/marvin.nix +++ b/user/marvin.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ config, pkgs, ... }: { imports = [ ./settings/base.nix ./settings/development/base.nix @@ -24,19 +24,53 @@ ]; home.packages = with pkgs; [ picocom + ollama ]; + launchd.agents = { + ollama = { + enable = true; + config = { + ProgramArguments = [ "/Users/alan/.local/state/nix/profile/bin/ollama" "serve" ]; + RunAtLoad = true; + KeepAlive = true; + WorkingDirectory = "/Users/alan"; + EnvironmentVariables = { + OLLAMA_KEEP_ALIVE = "-1"; # keep models in memory forever + OLLAMA_FLASH_ATTENTION = "1"; # significantly reduce memory usage as the context size grows + }; + }; + }; + ollama-preload = { + enable = true; + config = { + ProgramArguments = [ + "/Users/alan/.local/state/nix/profile/bin/ollama" + "run" + "llama3.3" + "" + ]; + RunAtLoad = true; + KeepAlive = false; + WorkingDirectory = "/Users/alan"; + }; + }; + }; + launchd.agents.colima = { enable = true; config = { - ProgramArguments = [ "${pkgs.colima}/bin/colima" "start" ]; + ProgramArguments = [ "/Users/alan/.local/state/nix/profile/bin/colima" "start" ]; RunAtLoad = true; # It doesn't run in the foreground, yet... # KeepAlive = true; WorkingDirectory = "/Users/alan"; StandardOutPath = "/Users/alan/Library/Logs/colima.log"; StandardErrorPath = "/Users/alan/Library/Logs/colima.log"; - EnvironmentVariables.HOME = "/Users/alan"; + EnvironmentVariables = { + HOME = "/Users/alan"; + XDG_CONFIG_HOME = config.xdg.configHome; + }; }; }; -- cgit 1.4.1