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:50:56 +01:00
parent f6b80d4cde
commit 4b5bd4197d
3 changed files with 348 additions and 323 deletions
+14 -5
View File
@@ -6,14 +6,23 @@ let
# Read and parse the config file (assuming it's in shell variable format)
ollamaConf = builtins.readFile ollamaConfPath;
# Extract values using regex (adjust if your format differs)
# Split the file into lines and filter out comments/empty lines
lines = lib.filter (line: line != "" && ! (lib.hasPrefix "#" line))
(lib.splitString "\n" ollamaConf);
# Extract the last value for a given key
extractValue = key:
let
match = builtins.match ("(?m)^${key}=\"([^\"]+)\"$") ollamaConf;
# Find all lines matching the key
matches = lib.map (
line: builtins.match ("^${key}=\"([^\"]+)\"$") line
) lines;
# Filter out null matches and get the last one
nonNullMatches = lib.filter (match: match != null) matches;
in
if match != null && match != [] then
# Return the first capture group of the first match
builtins.elemAt (builtins.elemAt match 0) 1
if nonNullMatches != [] then
# Return the first capture group of the last match
builtins.elemAt (builtins.elemAt (lib.elemAt nonNullMatches (lib.length nonNullMatches - 1)) 0) 1
else
null;