(address . guix-patches@gnu.org)(name . Dan Frumin)(address . dfrumin@cs.ru.nl)
---
guix/search-paths.scm | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
Toggle diff (44 lines)
diff --git a/guix/search-paths.scm b/guix/search-paths.scm
index 002e6342bb..fe9253e88e 100644
--- a/guix/search-paths.scm
+++ b/guix/search-paths.scm
@@ -177,15 +177,28 @@ current value), or 'suffix (return the definition where VALUE is added as a
suffix to VARIABLE's current value.) In the case of 'prefix and 'suffix,
SEPARATOR is used as the separator between VARIABLE's current value and its
prefix/suffix."
- (match (if (not separator) 'exact kind)
- ('exact
- (format #f "export ~a=\"~a\"" variable value))
- ('prefix
- (format #f "export ~a=\"~a${~a:+~a}$~a\""
- variable value variable separator variable))
- ('suffix
- (format #f "export ~a=\"$~a${~a:+~a}~a\""
- variable variable variable separator value))))
+ (let* ([shell-env (getenv "SHELL")]
+ [is-fish? (and shell-env
+ (equal? (last (string-split shell-env #\/))
+ "fish"))])
+ (match (if (not separator) 'exact kind)
+ ('exact
+ (if is-fish?
+ ;; See <https://fishshell.com/docs/current/commands.html#set> for syntax
+ (format #f "set -x ~a \"~a\"" variable value)
+ (format #f "export ~a=\"~a\"" variable value)))
+ ('prefix
+ (if is-fish?
+ (format #f "set -x ~a \"~a\" $~a"
+ variable value variable)
+ (format #f "export ~a=\"~a${~a:+~a}$~a\""
+ variable value variable separator variable)))
+ ('suffix
+ (if is-fish?
+ (format #f "set -x ~a $~a \"~a\""
+ variable variable value)
+ (format #f "export ~a=\"$~a${~a:+~a}~a\""
+ variable variable variable separator value))))))
(define* (search-path-definition search-path value
#:key (kind 'exact))
--
2.17.1