Modified guix/profiles.scm
Toggle diff (111 lines)
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 8445e00..308dc23 100644
@@ -582,10 +582,15 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx."
(define* (profile-derivation manifest
(hooks %default-profile-hooks))
"Return a derivation that builds a profile (aka. 'user environment') with
the given MANIFEST. The profile includes additional derivations returned by
-the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc."
+the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc.
+When TARGET is not #f, it must be a string denoting the file name under which
+the profile will be available--e.g., \"/home/rms/.guix-profile\". This name
+is used in the profile's 'etc/profile' file (read that again.)"
(mlet %store-monad ((extras (if (null? (manifest-entries manifest))
@@ -598,20 +603,72 @@ the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc."
- (use-modules (ice-9 pretty-print)
+ (use-modules (ice-9 match)
+ (map sexp->search-path-specification
+ '#$(map search-path-specification->sexp
+ (append-map manifest-entry-search-paths
+ (manifest-entries manifest)))))
+ (define (use-target value separator)
+ (let ((items ((@@ (guix search-paths) string-tokenize*)
+ (string-join (map (lambda (str)
+ (define write-environment-variable-definition
+ (let ((variable (search-path-specification-variable spec))
+ (sep (search-path-specification-separator spec)))
+ (environment-variable-definition variable
(setvbuf (current-output-port) _IOLBF)
(setvbuf (current-error-port) _IOLBF)
(union-build #$output '#$inputs
#:log-port (%make-void-port "w"))
(call-with-output-file (string-append #$output "/manifest")
- (pretty-print '#$(manifest->gexp manifest) p)))))
+ (pretty-print '#$(manifest->gexp manifest) p)))
+ ;; Store a ready-to-use Bash profile.
+ (mkdir-p (string-append #$output "/etc"))
+ (with-output-to-file (string-append #$output "/etc/profile")
+ (let ((variables (evaluate-search-paths search-paths #$output)))
+ (for-each write-environment-variable-definition
(gexp->derivation "profile" builder
- #:modules '((guix build union))
+ #:modules '((guix build union)
(define (profile-regexp profile)
Modified guix/scripts/package.scm
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 7f53af7..38ec8ed 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -833,6 +833,7 @@ more information.~%"))
(let* ((prof-drv (run-with-store (%store)
+ #:target (user-friendly-profile profile)
%default-profile-hooks))))