New Ollama.nix, the ai.nix did not work out. Added ZED-editor as separate app

This commit is contained in:
2026-02-28 14:49:12 +01:00
parent 60de75da07
commit f6b80d4cde
3 changed files with 345 additions and 324 deletions
+13 -6
View File
@@ -1650,9 +1650,16 @@ let
ollamaConf = builtins.readFile ollamaConfPath;
# Extract values using regex (adjust if your format differs)
extractValue = key: builtins.match
("(?m)^${key}=\"([^\"]+)\"$")
ollamaConf;
extractValue = key:
let
match = builtins.match ("(?m)^${key}=\"([^\"]+)\"$") ollamaConf;
in
if match != null && match != [] then
# Return the first capture group of the first match
builtins.elemAt (builtins.elemAt match 0) 1
else
null;
ollamaHost = extractValue "OLLAMA_HOST";
ollamaDefaultModel = extractValue "OLLAMA_DEFAULT_MODEL";
in
@@ -1664,8 +1671,8 @@ in
# Configure Ollama environment variables
home.sessionVariables = {
OLLAMA_HOST = if ollamaHost != "" then ollamaHost else "http://127.0.0.1:11434";
OLAMA_DEFAULT_MODEL = if ollamaDefaultModel != "" then ollamaDefaultModel else "codellama:70b";
OLLAMA_HOST = if ollamaHost != null then ollamaHost else "http://127.0.0.1:11434";
OLAMA_DEFAULT_MODEL = if ollamaDefaultModel != null then ollamaDefaultModel else "codellama:70b";
};
# Optional: Start Ollama service (if using NixOS)
@@ -1676,7 +1683,7 @@ in
ExecStart = "${pkgs.ollama}/bin/ollama serve";
Restart = "on-failure";
Environment = [
"OLLAMA_HOST=${if ollamaHost != "" then ollamaHost else "http://127.0.0.1:11434"}"
"OLLAMA_HOST=${if ollamaHost != null then ollamaHost else "http://127.0.0.1:11434"}"
];
};
};