summary refs log tree commit diff stats
path: root/user/marvin.nix
diff options
context:
space:
mode:
authorAlan Pearce2024-12-30 14:29:04 +0100
committerAlan Pearce2024-12-30 14:29:33 +0100
commit734dacb51e1dde9616208652d9d9a70a927d31e0 (patch)
tree78202c2cc92a12793b48882446bfb48923e042ea /user/marvin.nix
parentbde4db59a7e054713f866f3c1a235fbbe4c20f51 (diff)
downloadnixfiles-734dacb51e1dde9616208652d9d9a70a927d31e0.tar.lz
nixfiles-734dacb51e1dde9616208652d9d9a70a927d31e0.tar.zst
nixfiles-734dacb51e1dde9616208652d9d9a70a927d31e0.zip
marvin: improve colima setup
Diffstat (limited to 'user/marvin.nix')
-rw-r--r--user/marvin.nix40
1 files 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;
+      };
     };
   };