guix-epistemia

Personal Guix channel
Log | Files | Refs

commit e07c33fe14d150ed09ad7cc77355fe1750ba5618
parent fdd166c2f37f448b90022ff5d7c60dbd8610a90e
Author: Vineet Kumar <git@vineetk.net>
Date:   Sat,  2 May 2026 17:33:22 -0400

packages and services: drop llama-swap

I really really really don't like its codebase. Also extremely hard to
package for its newer versions. I made a replacement instead that I
need to package and make service for.

Diffstat:
Mepistemia/packages/machine-learning.scm | 42------------------------------------------
Mepistemia/services/machine-learning.scm | 58++++++++++++++++++++++++++--------------------------------
2 files changed, 26 insertions(+), 74 deletions(-)

diff --git a/epistemia/packages/machine-learning.scm b/epistemia/packages/machine-learning.scm @@ -91,45 +91,3 @@ hipblas hipblas-common rocblas))))) - -(define-public llama-swap - (package - (name "llama-swap") - ;; after this is using react and then svelte instead of plain - ;; html. also no longer using google/shlex after this. - (version "115") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/mostlygeek/llama-swap") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 "0g8shkyihfg5nan34fi3nyaww2a4mxvwy4w0drxd3ipfrxglj8ms")))) - (build-system go-build-system) - (arguments - (list - #:import-path "github.com/mostlygeek/llama-swap" - #:install-source? #f - #:phases - #~(modify-phases %standard-phases - (add-before 'check 'simple-responder - (lambda _ - (with-directory-excursion "src/github.com/mostlygeek/llama-swap" - (invoke "make" "simple-responder"))))))) - (native-inputs (list gnu-make)) - (propagated-inputs (list go-github-com-fsnotify-fsnotify - go-github-com-gin-gonic-gin - go-github-com-google-shlex - go-github-com-tidwall-gjson - go-github-com-tidwall-sjson - go-github-com-stretchr-testify - go-gopkg-in-yaml-v3)) - (home-page "https://github.com/mostlygeek/llama-swap") - (synopsis "llama-swap") - (description - "llama-swap is an @code{OpenAI} API compatible server that gives you complete -control over how you use your hardware. It automatically swaps to the -configuration of your choice for serving a model.") - (license license:expat))) diff --git a/epistemia/services/machine-learning.scm b/epistemia/services/machine-learning.scm @@ -9,59 +9,53 @@ llama-swap-configuration? llama-swap-service-type)) -(define-record-type* <llama-swap-configuration> - llama-swap-configuration make-llama-swap-configuration - llama-swap-configuration? - (package llama-swap-configuration-package - (default llama-swap)) - (llama-cpp llama-swap-configuration-llama-cpp +(define-record-type* <llm-router-configuration> + llm-router-configuration make-llm-router-configuration + llm-router-configuration? + (package llm-router-configuration-package + (default llm-router)) + (llama-cpp llm-router-configuration-llama-cpp (default llama-cpp)) - (config llama-swap-configuration-config) - (listen llama-swap-configuration-listen + (config llm-router-configuration-config) + (listen llm-router-configuration-listen (default ":8080")) - (watch-config? llama-swap-configuration-watch-config? + (watch-config? llm-router-configuration-watch-config? (default #f))) -(define llama-swap-account-service +(define llm-router-account-service (list (user-account - (name "llama-swap") + (name "llm-router") (group "nogroup") (system? #t) - (comment "llama-swap daemon user") + (comment "llm-router daemon user") (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) -(define (llama-swap-shepherd-service config) - (let ((pkg (llama-swap-configuration-package config)) - (lcpp (llama-swap-configuration-llama-cpp config)) - (cfg (llama-swap-configuration-config config)) - (listen (llama-swap-configuration-listen config)) - (watch? (llama-swap-configuration-watch-config? config))) +(define (llm-router-shepherd-service config) + (let ((pkg (llm-router-configuration-package config)) + (lcpp (llm-router-configuration-llama-cpp config)) + (cfg (llm-router-configuration-config config))) (list (shepherd-service - (documentation "llama-swap OpenAI-compatible model proxy") - (provision '(llama-swap)) + (documentation "llm-router OpenAI-compatible model proxy") + (provision '(llm-router)) (requirement '(networking)) (start #~(make-forkexec-constructor (append - (list #$(file-append pkg "/bin/llama-swap") - "-config" #$cfg - "-listen" #$listen) - (if #$watch? '("-watch-config") '())) - #:user "llama-swap" + (list #$(file-append pkg "/bin/llm-router"))) + #:user "llm-router" #:environment-variables (cons (string-append "PATH=" #$(file-append lcpp "/bin")) (default-environment-variables)))) (stop #~(make-kill-destructor)))))) -(define llama-swap-service-type - (service-type (name 'llama-swap) +(define llm-router-service-type + (service-type (name 'llm-router) (extensions (list (service-extension account-service-type - (const llama-swap-account-service)) + (const llm-router-account-service)) (service-extension shepherd-root-service-type - llama-swap-shepherd-service))) + llm-router-shepherd-service))) (description - "llama-swap is an @code{OpenAI} API compatible server that gives you complete -control over how you use your hardware. It automatically swaps to the -configuration of your choice for serving a model."))) + "llm-router is a proxy to OpenAI-compatible and SDAPI-compatible API +servers.")))