Subject: [bug#45064] [PATCH 1/2] profiles: Load application specific startup files.

From: [email-masked]
Date: Sun, 6 Dec 2020 14:15:14 +0800

From: 宋文武 <[email-masked]>

* guix/build/profiles.scm (build-etc/profile): Source application specific
startup files in 'etc/profile.d'.
---
 guix/build/profiles.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm
index 67ee9b665a..25165e0edb 100644
--- a/guix/build/profiles.scm
+++ b/guix/build/profiles.scm
@@ -98,7 +98,17 @@ definitions for all the SEARCH-PATHS."
       (let ((variables (evaluate-search-paths search-paths
                                               (list output))))
         (for-each (write-environment-variable-definition port)
-                  (map (abstract-profile output) variables))))))
+                  (map (abstract-profile output) variables)))
+
+      (simple-format port "
+# Load application specific startup files.
+if test -d ~a/etc/profile.d; then
+    for script in ~a/etc/profile.d/*.sh; do
+        source \"$script\"
+    done
+    unset script
+fi
+\n" output output))))
 
 (define* (ensure-writable-directory directory
                                     #:key (symlink symlink))
-- 
2.29.2