New Ollama.nix, the ai.nix did not work out. Added ZED-editor as separate app
This commit is contained in:
+320
-312
File diff suppressed because it is too large
Load Diff
+14
-6
@@ -1649,14 +1649,23 @@ let
|
|||||||
# Read and parse the config file (assuming it's in shell variable format)
|
# Read and parse the config file (assuming it's in shell variable format)
|
||||||
ollamaConf = builtins.readFile ollamaConfPath;
|
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:
|
extractValue = key:
|
||||||
let
|
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
|
in
|
||||||
if match != null && match != [] then
|
if nonNullMatches != [] then
|
||||||
# Return the first capture group of the first match
|
# Return the first capture group of the last match
|
||||||
builtins.elemAt (builtins.elemAt match 0) 1
|
builtins.elemAt (builtins.elemAt (lib.elemAt nonNullMatches (lib.length nonNullMatches - 1)) 0) 1
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
|
||||||
@@ -1688,7 +1697,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** NCSway
|
** NCSway
|
||||||
|
|||||||
@@ -6,14 +6,23 @@ let
|
|||||||
# Read and parse the config file (assuming it's in shell variable format)
|
# Read and parse the config file (assuming it's in shell variable format)
|
||||||
ollamaConf = builtins.readFile ollamaConfPath;
|
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:
|
extractValue = key:
|
||||||
let
|
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
|
in
|
||||||
if match != null && match != [] then
|
if nonNullMatches != [] then
|
||||||
# Return the first capture group of the first match
|
# Return the first capture group of the last match
|
||||||
builtins.elemAt (builtins.elemAt match 0) 1
|
builtins.elemAt (builtins.elemAt (lib.elemAt nonNullMatches (lib.length nonNullMatches - 1)) 0) 1
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user