Personal Nix setup
0
fork

Configure Feed

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

Add missing ollama parameters

+47
+47
home/apps/ollama.nix
··· 7 7 "${pkgs.ollama}/bin/ollama" 8 8 "serve" 9 9 ]; 10 + 11 + toEnvironmentCfg = vars: mapAttrsToList (k: v: "${k}=${escapeShellArg v}") vars; 12 + 13 + env = { 14 + OLLAMA_HOST = cfg.ollama.host; 15 + OLLAMA_FLASH_ATTENTION = if cfg.ollama.flashAttention then "1" else "0"; 16 + OLLAMA_SCHED_SPREAD = if cfg.ollama.schedSpread then "1" else "0"; 17 + OLLAMA_INTEL_GPU = if cfg.ollama.intelGpu then "1" else "0"; 18 + }; 10 19 in { 11 20 options.modules.apps.ollama = { 12 21 enable = mkOption { ··· 14 23 description = "Whether to enable Ollama."; 15 24 type = types.bool; 16 25 }; 26 + 27 + host = mkOption { 28 + default = "http://0.0.0.0:11434"; 29 + description = "Determines the host and port to listen on"; 30 + type = types.str; 31 + }; 32 + 33 + flashAttention = mkOption { 34 + default = false; 35 + description = '' 36 + Enables experimental flash att ention feature. 37 + Effect: Activates an experimental optimization for attention mechanisms. 38 + Scenario: Can potentially improve performance on compatible hardware but may introduce instability. 39 + ''; 40 + type = types.bool; 41 + }; 42 + 43 + schedSpread = mkOption { 44 + default = false; 45 + description = '' 46 + Allows scheduling models across all GPUs. 47 + Effect: Enables multi-GPU usage for model inference. 48 + Scenario: Beneficial in high-performance computing environments with multiple GPUs to maximize hardware utilization. 49 + ''; 50 + type = types.bool; 51 + }; 52 + 53 + intelGpu = mkOption { 54 + default = false; 55 + description = '' 56 + Enables experimental Intel GPU detection. 57 + Effect: Allows usage of Intel GPUs for model inference. 58 + Scenario: Useful for organizations leveraging Intel GPU hardware for AI workloads. 59 + ''; 60 + type = types.bool; 61 + }; 17 62 }; 18 63 19 64 config = mkIf (cfg.enable && cfg.ollama.enable) (mkMerge [ ··· 29 74 }; 30 75 Install.WantedBy = [ "default.target" ]; 31 76 Service = { 77 + Environment = toEnvironmentCfg env; 32 78 ExecStart = escapeShellArgs ollamaArgs; 33 79 Restart = "on-failure"; 34 80 RestartSec = 5; ··· 40 86 launchd.agents.ollama = { 41 87 enable = true; 42 88 config = { 89 + EnvironmentVariables = env; 43 90 ProcessType = "Background"; 44 91 ProgramArguments = ollamaArgs; 45 92 KeepAlive = {