rebuilding nix files
This commit is contained in:
+321
-318
File diff suppressed because it is too large
Load Diff
+15
-12
@@ -1651,25 +1651,22 @@ let
|
|||||||
# Path to the ZED configuration template
|
# Path to the ZED configuration template
|
||||||
AiRepoConf = flakeRoot + "/assets/conf/apps/ai/ai.conf";
|
AiRepoConf = flakeRoot + "/assets/conf/apps/ai/ai.conf";
|
||||||
|
|
||||||
# Improved environment file parser that handles:
|
# Robust environment file parser
|
||||||
# - Lines with multiple '=' characters
|
|
||||||
# - Empty values
|
|
||||||
# - Whitespace around keys and values
|
|
||||||
# - Comments (lines starting with #)
|
|
||||||
envVars = lib.genAttrs (
|
envVars = lib.genAttrs (
|
||||||
builtins.map (
|
builtins.map (
|
||||||
line: let
|
line: let
|
||||||
# Remove comments and trim whitespace
|
# Trim whitespace from the line
|
||||||
cleanLine = builtins.trim (builtins.replaceStrings [ "#" ] [ "" ] (builtins.elemAt (builtins.split "#" line) 0));
|
trimmed = builtins.trim line;
|
||||||
|
# Skip comments and empty lines
|
||||||
|
isValid = trimmed != "" && (builtins.substr 0 1 trimmed) != "#";
|
||||||
# Split on first '=' only
|
# Split on first '=' only
|
||||||
parts = builtins.split "=" cleanLine;
|
parts = if isValid then builtins.split "=" trimmed else [ ];
|
||||||
# Get key (first part) and trim whitespace
|
# Get key (first part) and trim whitespace
|
||||||
key = builtins.trim (builtins.elemAt parts 0);
|
key = if builtins.length parts > 0 then builtins.trim (builtins.elemAt parts 0) else null;
|
||||||
# Get value (everything after first '=') and trim whitespace
|
# Get value (everything after first '=') and trim whitespace
|
||||||
value = builtins.trim (builtins.concatStringsSep "=" (builtins.drop 1 parts));
|
value = if builtins.length parts > 1 then builtins.trim (builtins.concatStringsSep "=" (builtins.drop 1 parts)) else "";
|
||||||
in { inherit key value; }
|
in { inherit key value; }
|
||||||
) (builtins.filter (line: line != "" && !builtins.startsWith "#" line)
|
) (builtins.split "\n" (builtins.readFile (toString AiRepoEnv)))
|
||||||
(builtins.split "\n" (builtins.readFile (toString AiRepoEnv))))
|
|
||||||
) (entry: entry.key);
|
) (entry: entry.key);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -1721,6 +1718,12 @@ in
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Filter out null entries from envVars
|
||||||
|
home.file.".config/ai-env-test".text = lib.mkForce (
|
||||||
|
builtins.toJSON envVars
|
||||||
|
);
|
||||||
|
|
||||||
# --- Usage Notes ---
|
# --- Usage Notes ---
|
||||||
# 1. Pulling Additional Models:
|
# 1. Pulling Additional Models:
|
||||||
# To add more models later, run:
|
# To add more models later, run:
|
||||||
|
|||||||
@@ -6,25 +6,22 @@ let
|
|||||||
# Path to the ZED configuration template
|
# Path to the ZED configuration template
|
||||||
AiRepoConf = flakeRoot + "/assets/conf/apps/ai/ai.conf";
|
AiRepoConf = flakeRoot + "/assets/conf/apps/ai/ai.conf";
|
||||||
|
|
||||||
# Improved environment file parser that handles:
|
# Robust environment file parser
|
||||||
# - Lines with multiple '=' characters
|
|
||||||
# - Empty values
|
|
||||||
# - Whitespace around keys and values
|
|
||||||
# - Comments (lines starting with #)
|
|
||||||
envVars = lib.genAttrs (
|
envVars = lib.genAttrs (
|
||||||
builtins.map (
|
builtins.map (
|
||||||
line: let
|
line: let
|
||||||
# Remove comments and trim whitespace
|
# Trim whitespace from the line
|
||||||
cleanLine = builtins.trim (builtins.replaceStrings [ "#" ] [ "" ] (builtins.elemAt (builtins.split "#" line) 0));
|
trimmed = builtins.trim line;
|
||||||
|
# Skip comments and empty lines
|
||||||
|
isValid = trimmed != "" && (builtins.substr 0 1 trimmed) != "#";
|
||||||
# Split on first '=' only
|
# Split on first '=' only
|
||||||
parts = builtins.split "=" cleanLine;
|
parts = if isValid then builtins.split "=" trimmed else [ ];
|
||||||
# Get key (first part) and trim whitespace
|
# Get key (first part) and trim whitespace
|
||||||
key = builtins.trim (builtins.elemAt parts 0);
|
key = if builtins.length parts > 0 then builtins.trim (builtins.elemAt parts 0) else null;
|
||||||
# Get value (everything after first '=') and trim whitespace
|
# Get value (everything after first '=') and trim whitespace
|
||||||
value = builtins.trim (builtins.concatStringsSep "=" (builtins.drop 1 parts));
|
value = if builtins.length parts > 1 then builtins.trim (builtins.concatStringsSep "=" (builtins.drop 1 parts)) else "";
|
||||||
in { inherit key value; }
|
in { inherit key value; }
|
||||||
) (builtins.filter (line: line != "" && !builtins.startsWith "#" line)
|
) (builtins.split "\n" (builtins.readFile (toString AiRepoEnv)))
|
||||||
(builtins.split "\n" (builtins.readFile (toString AiRepoEnv))))
|
|
||||||
) (entry: entry.key);
|
) (entry: entry.key);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -76,6 +73,12 @@ in
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Filter out null entries from envVars
|
||||||
|
home.file.".config/ai-env-test".text = lib.mkForce (
|
||||||
|
builtins.toJSON envVars
|
||||||
|
);
|
||||||
|
|
||||||
# --- Usage Notes ---
|
# --- Usage Notes ---
|
||||||
# 1. Pulling Additional Models:
|
# 1. Pulling Additional Models:
|
||||||
# To add more models later, run:
|
# To add more models later, run:
|
||||||
|
|||||||
Reference in New Issue
Block a user