Personal Nix setup
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add ollama daemon

+44
+1
home/default.nix
··· 6 6 ./zsh.nix 7 7 ./tmux.nix 8 8 ./rbw.nix 9 + ./ollama.nix 9 10 ./wezterm 10 11 ./npm 11 12 ./gpg
+41
home/ollama.nix
··· 1 + { helpers, lib, pkgs, ... }: 2 + 3 + let 4 + ollamaArgs = [ 5 + "${pkgs.ollama}/bin/ollama" 6 + "serve" 7 + ]; 8 + in { 9 + config = lib.mkMerge [ 10 + { home.packages = [ pkgs.ollama ]; } 11 + 12 + (helpers.mkIfLinux { 13 + systemd.user.services.ollama = { 14 + Unit = { 15 + Description = "Ollama"; 16 + Documentation = "https://github.com/jmorganca/ollama"; 17 + }; 18 + Install.WantedBy = [ "default.target" ]; 19 + Service = { 20 + ExecStart = lib.escapeShellArgs ollamaArgs; 21 + Restart = "on-failure"; 22 + RestartSec = 5; 23 + }; 24 + }; 25 + }) 26 + 27 + (helpers.mkIfDarwin { 28 + launchd.agents.ollama = { 29 + enable = true; 30 + config = { 31 + ProcessType = "Background"; 32 + ProgramArguments = ollamaArgs; 33 + KeepAlive = { 34 + Crashed = true; 35 + SuccessfulExit = false; 36 + }; 37 + }; 38 + }; 39 + }) 40 + ]; 41 + }
+2
lib/helpers.nix
··· 7 7 inherit isLinux isDarwin; 8 8 linuxAttrs = lib.attrsets.optionalAttrs isLinux; 9 9 darwinAttrs = lib.attrsets.optionalAttrs isDarwin; 10 + mkIfLinux = lib.mkIf isLinux; 11 + mkIfDarwin = lib.mkIf isDarwin; 10 12 }