feat(pi): add statusline package
This commit is contained in:
@@ -18,6 +18,7 @@ let
|
|||||||
# writing other fields (current model, etc.) without us clobbering them.
|
# writing other fields (current model, etc.) without us clobbering them.
|
||||||
piPackages = [
|
piPackages = [
|
||||||
"https://gitea.va.reichard.io/evan/pi-lsp.git@main"
|
"https://gitea.va.reichard.io/evan/pi-lsp.git@main"
|
||||||
|
"https://gitea.va.reichard.io/evan/pi-statusline.git@main"
|
||||||
];
|
];
|
||||||
|
|
||||||
piPackagesJson = pkgs.writeText "pi-packages.json" (builtins.toJSON piPackages);
|
piPackagesJson = pkgs.writeText "pi-packages.json" (builtins.toJSON piPackages);
|
||||||
@@ -33,13 +34,21 @@ let
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
piAuthJqRawfiles = lib.concatStringsSep " \\\n " (map
|
piAuthJqRawfiles = lib.concatStringsSep " \\\n " (
|
||||||
(auth: ''--rawfile ${auth.jqVar} "${config.sops.secrets.${auth.secretName}.path}"'')
|
map
|
||||||
piAuthApiKeys);
|
(
|
||||||
|
auth: ''--rawfile ${auth.jqVar} "${config.sops.secrets.${auth.secretName}.path}"''
|
||||||
|
)
|
||||||
|
piAuthApiKeys
|
||||||
|
);
|
||||||
|
|
||||||
piAuthJqFilter = lib.concatStringsSep " | " (map
|
piAuthJqFilter = lib.concatStringsSep " | " (
|
||||||
(auth: ''.["${auth.provider}"] = { type: "api_key", key: ($'' + auth.jqVar + '' | rtrimstr("\n")) }'')
|
map
|
||||||
piAuthApiKeys);
|
(
|
||||||
|
auth: ''.["${auth.provider}"] = { type: "api_key", key: ($'' + auth.jqVar + ''| rtrimstr("\n")) }''
|
||||||
|
)
|
||||||
|
piAuthApiKeys
|
||||||
|
);
|
||||||
|
|
||||||
piAuthMergeScript = pkgs.writeShellScript "pi-auth-merge" ''
|
piAuthMergeScript = pkgs.writeShellScript "pi-auth-merge" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -51,7 +60,11 @@ let
|
|||||||
rm "$PI_AUTH"
|
rm "$PI_AUTH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for secret in ${lib.concatStringsSep " " (map (auth: ''"${config.sops.secrets.${auth.secretName}.path}"'') piAuthApiKeys)}; do
|
for secret in ${
|
||||||
|
lib.concatStringsSep " " (
|
||||||
|
map (auth: ''"${config.sops.secrets.${auth.secretName}.path}"'') piAuthApiKeys
|
||||||
|
)
|
||||||
|
}; do
|
||||||
if [ ! -e "$secret" ]; then
|
if [ ! -e "$secret" ]; then
|
||||||
echo "Skipping pi auth merge; missing sops secret: $secret" >&2
|
echo "Skipping pi auth merge; missing sops secret: $secret" >&2
|
||||||
exit 0
|
exit 0
|
||||||
@@ -105,12 +118,15 @@ in
|
|||||||
"llama_swap_api_keys/pi" = {
|
"llama_swap_api_keys/pi" = {
|
||||||
sopsFile = lib.snowfall.fs.get-file "secrets/common/llama-swap.yaml";
|
sopsFile = lib.snowfall.fs.get-file "secrets/common/llama-swap.yaml";
|
||||||
};
|
};
|
||||||
} // lib.listToAttrs (map
|
}
|
||||||
|
// lib.listToAttrs (
|
||||||
|
map
|
||||||
(auth: {
|
(auth: {
|
||||||
name = auth.secretName;
|
name = auth.secretName;
|
||||||
value.sopsFile = auth.sopsFile;
|
value.sopsFile = auth.sopsFile;
|
||||||
})
|
})
|
||||||
piAuthApiKeys);
|
piAuthApiKeys
|
||||||
|
);
|
||||||
templates."pi-models.json" = {
|
templates."pi-models.json" = {
|
||||||
path = "${config.home.homeDirectory}/.pi/agent/models.json";
|
path = "${config.home.homeDirectory}/.pi/agent/models.json";
|
||||||
content = builtins.toJSON {
|
content = builtins.toJSON {
|
||||||
|
|||||||
Reference in New Issue
Block a user