all repos — nixfiles @ 443394939cda6f71666c678698e5be6f280d5ea5

System and user configuration, managed by nix and home-manager

llama-swap: allow adding any packages to service PATH

Alin
commit

443394939cda6f71666c678698e5be6f280d5ea5

parent

e81fd5dcb589e0de1c9034ff7a0179b86d96410e

1 file changed, 30 insertions(+), 8 deletions(-)

changed files
M user/modules/llama-swap.nix → user/modules/llama-swap.nix
@@ -25,8 +25,32 @@ enable = lib.mkEnableOption "the llama-swap service";
package = lib.mkPackageOption pkgs "llama-swap" { }; - llamaPackage = lib.mkPackageOption pkgs "llama-cpp" { - extraDescription = "llama-cpp package added to llama-swap's PATH"; + packages = lib.mkOption { + default = lib.optionals (cfg.configFile != null) [ pkgs.llama-cpp ]; + defaultText = lib.literalExpression '' + lib.optionals (cfg.configFile != null) [ pkgs.llama-cpp ] + ''; + example = lib.literalExpression '' + [ + pkgs.llama-cpp-rocm + pkgs.vllm + ] + ''; + type = lib.types.listOf lib.types.package; + description = '' + Packages to add to llama-swap process's PATH. + Useful if using `configFile` instead of `settings`. + ''; + }; + + exposePackages = lib.mkOption { + default = cfg.configFile != null; + defaultText = lib.literalExpression "cfg.configFile != null"; + type = lib.types.bool; + description = '' + Whether to additionally add `packages` to user profile. + Useful when using `configFile` instead of `settings`. + ''; }; listenAddress = lib.mkOption {
@@ -115,7 +139,7 @@
# for GPU acceleration PrivateDevices = false; }; - path = [ cfg.llamaPackage ]; + path = cfg.packages; }; launchd.agents.llama-swap = {
@@ -128,16 +152,14 @@ SuccessfulExit = false;
}; ProcessType = "Background"; EnvironmentVariables = { - PATH = lib.makeBinPath [ - cfg.llamaPackage - ]; + PATH = lib.makeBinPath cfg.packages; }; }; }; home.packages = [ cfg.package - cfg.llamaPackage - ]; + ] + ++ (lib.optionals cfg.exposePackages cfg.packages); }; }