Hello, I have a guile application that I would like to wrap using wrap-program. For that I need to set multiple environment variables based on the search-paths. In the end I have managed to get it working, but the code is *very* verbose, so I keep thinking there just has to be a better way. I cannot be the first person who want to do this, so I assume I have just missed something obvious in the manual. Would anyone be able to suggest a better way to approach this?
My current version: --8<---------------cut here---------------start------------->8--- (arguments (list #:imported-modules (append (source-module-closure '((guix search-paths))) %default-gnu-imported-modules) #:modules `((guix search-paths) ,@%default-gnu-modules) #:phases #~(modify-phases %standard-phases (add-after 'install 'wrap (λ _ (let* ((build-inputs (map cdr %build-inputs)) (directories (cons #$output build-inputs)) (locale-path #$(file-append glibc-locales "/lib/locale")) (guile-bin #$(file-append guile-3.0 "/bin")) (load-path (cdar (evaluate-search-paths (list (search-path-specification (variable "GUILE_LOAD_PATH") (files '("share/guile/site/3.0")))) directories))) (load-compiled-path (cdar (evaluate-search-paths (list (search-path-specification (variable "GUILE_LOAD_COMPILED_PATH") (files '("lib/guile/3.0/site-ccache" "share/guile/site/3.0")))) directories))) (extension-path (cdar (evaluate-search-paths (list (search-path-specification (variable "GUILE_EXTENSIONS_PATH") (files (list "lib/guile/3.0/extensions")))) directories)))) (wrap-program (string-append #$output "/bin/watcher") `("LC_CTYPE" = ("C.UTF-8")) `("GUIX_LOCPATH" = (,locale-path)) `("GUILE_LOAD_PATH" = (,load-path)) `("GUILE_LOAD_COMPILED_PATH" = (,load-compiled-path)) `("GUILE_EXTENSIONS_PATH" = (,extension-path)) `("PATH" = (,guile-bin))))))))) --8<---------------cut here---------------end--------------->8--- Thanks, Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
signature.asc
Description: PGP signature