New Ollama.nix, the ai.nix did not work out. Added ZED-editor as separate app
This commit is contained in:
+319
-312
File diff suppressed because it is too large
Load Diff
+13
-6
@@ -1650,9 +1650,16 @@ let
|
|||||||
ollamaConf = builtins.readFile ollamaConfPath;
|
ollamaConf = builtins.readFile ollamaConfPath;
|
||||||
|
|
||||||
# Extract values using regex (adjust if your format differs)
|
# Extract values using regex (adjust if your format differs)
|
||||||
extractValue = key: builtins.match
|
extractValue = key:
|
||||||
("(?m)^${key}=\"([^\"]+)\"$")
|
let
|
||||||
ollamaConf;
|
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";
|
ollamaHost = extractValue "OLLAMA_HOST";
|
||||||
ollamaDefaultModel = extractValue "OLLAMA_DEFAULT_MODEL";
|
ollamaDefaultModel = extractValue "OLLAMA_DEFAULT_MODEL";
|
||||||
in
|
in
|
||||||
@@ -1664,8 +1671,8 @@ in
|
|||||||
|
|
||||||
# Configure Ollama environment variables
|
# Configure Ollama environment variables
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
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";
|
||||||
OLAMA_DEFAULT_MODEL = if ollamaDefaultModel != "" then ollamaDefaultModel else "codellama:70b";
|
OLAMA_DEFAULT_MODEL = if ollamaDefaultModel != null then ollamaDefaultModel else "codellama:70b";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Optional: Start Ollama service (if using NixOS)
|
# Optional: Start Ollama service (if using NixOS)
|
||||||
@@ -1676,7 +1683,7 @@ in
|
|||||||
ExecStart = "${pkgs.ollama}/bin/ollama serve";
|
ExecStart = "${pkgs.ollama}/bin/ollama serve";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
Environment = [
|
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"}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,9 +7,16 @@ let
|
|||||||
ollamaConf = builtins.readFile ollamaConfPath;
|
ollamaConf = builtins.readFile ollamaConfPath;
|
||||||
|
|
||||||
# Extract values using regex (adjust if your format differs)
|
# Extract values using regex (adjust if your format differs)
|
||||||
extractValue = key: builtins.match
|
extractValue = key:
|
||||||
("(?m)^${key}=\"([^\"]+)\"$")
|
let
|
||||||
ollamaConf;
|
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";
|
ollamaHost = extractValue "OLLAMA_HOST";
|
||||||
ollamaDefaultModel = extractValue "OLLAMA_DEFAULT_MODEL";
|
ollamaDefaultModel = extractValue "OLLAMA_DEFAULT_MODEL";
|
||||||
in
|
in
|
||||||
@@ -21,8 +28,8 @@ in
|
|||||||
|
|
||||||
# Configure Ollama environment variables
|
# Configure Ollama environment variables
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
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";
|
||||||
OLAMA_DEFAULT_MODEL = if ollamaDefaultModel != "" then ollamaDefaultModel else "codellama:70b";
|
OLAMA_DEFAULT_MODEL = if ollamaDefaultModel != null then ollamaDefaultModel else "codellama:70b";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Optional: Start Ollama service (if using NixOS)
|
# Optional: Start Ollama service (if using NixOS)
|
||||||
@@ -33,7 +40,7 @@ in
|
|||||||
ExecStart = "${pkgs.ollama}/bin/ollama serve";
|
ExecStart = "${pkgs.ollama}/bin/ollama serve";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
Environment = [
|
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"}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user