(import (srfi srfi-1)
        (ice-9 match)
        (guix search-paths)
        (guix profiles))

(define (do-it profile)
  (let* ((manifest (profile-manifest profile))
         (entries (manifest-entries manifest))
         (search-paths (delete-duplicates
                        (cons $PATH
                              (append-map manifest-entry-search-paths
                                          entries)))))
    (filter-map (match-lambda
                  ((spec . value)
                   (let ((variable (search-path-specification-variable spec)))
                     (format #true "~a=~a~%" variable value))))
                (evaluate-search-paths search-paths (list profile)
                                       getenv))))

(do-it "/home/rekado/.guix-profile")

Generated by Ricardo Wurmus using scpaste at Tue Oct 11 20:07:42 2022. CEST. (original)