diff options
author | Rutherther <rutherther@ditigal.xyz> | 2025-06-04 16:34:29 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-06-13 14:01:38 +0200 |
commit | 65bb0d92d87a1ef951fde0c28cb258e4570fdd36 (patch) | |
tree | a064117b0916be6b6105bbaa94e9ddaec1e0a61d | |
parent | 1f1b65ddbca580c3b9893cbc01daa0de709d1d20 (diff) |
pack: Singularity environemt sources the profile's 'etc/profile'.
Fixes #419 where the same search path is used multiple times, leading to the
last one overriding the previous one.
The solution relies on the #$profile/etc/profile file that is already verified
and in case of errors, it is just one place to repair instead of repairing at
multiple places, like in singularity-environment-file
* guix/pack.scm (singularity-environment-file): Source #$profile/etc/profile
Reported-by: Alexis Simon <alexis.simon@runbox.com>
Change-Id: Ic304fef99ad34d83e4e10cdd2b26d3b1802b5251
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | guix/scripts/pack.scm | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 857cb46af3..1d2046775c 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -312,25 +312,12 @@ added to the pack." "Return a shell script that defines the environment variables corresponding to the search paths of PROFILE." (define build - (with-extensions (list guile-gcrypt) - (with-imported-modules `(((guix config) => ,(make-config.scm)) - ,@(source-module-closure - `((guix profiles) - (guix search-paths)) - #:select? not-config?)) - #~(begin - (use-modules (guix profiles) (guix search-paths) - (ice-9 match)) + #~(begin + (use-modules (ice-9 match)) - (call-with-output-file #$output - (lambda (port) - (for-each (match-lambda - ((spec . value) - (format port "~a=~a~%export ~a~%" - (search-path-specification-variable spec) - value - (search-path-specification-variable spec)))) - (profile-search-paths #$profile)))))))) + (call-with-output-file #$output + (lambda (port) + (format port ". ~a/etc/profile~%" #$profile))))) (computed-file "singularity-environment.sh" build)) |