summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-12-26 19:11:27 +0100
committerLudovic Courtès <ludo@gnu.org>2023-01-05 14:20:23 +0100
commit73684dc90e013f2f0cca1097b0c944bb9aa88709 (patch)
tree4fddd86a52031d96cbb8fb2716f87e97f1507470 /doc
parent2c757e8fb4385f889ec91f02b77acdf27143c316 (diff)
home: services: environment-variables: Add support for literal strings.
* gnu/home/services.scm (<literal-string>): New record type. (environment-variable-shell-definitions): Split 'shell-quote' into 'quote-string' and 'shell-double-quote'. Add 'shell-single-quote'. Add clause for 'literal-string' records. * tests/guix-home.sh: Test it. * doc/guix.texi (Essential Home Services): Document it.
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi14
1 files changed, 11 insertions, 3 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 96b4675a01..32e34b7d52 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41007,13 +41007,15 @@ The easiest way to extend a service type, without defining a new service
type is to use the @code{simple-service} helper from @code{(gnu
services)}.
+@findex literal-string
@lisp
(simple-service 'some-useful-env-vars-service
home-environment-variables-service-type
`(("LESSHISTFILE" . "$XDG_CACHE_HOME/.lesshst")
("SHELL" . ,(file-append zsh "/bin/zsh"))
("USELESS_VAR" . #f)
- ("_JAVA_AWT_WM_NONREPARENTING" . #t)))
+ ("_JAVA_AWT_WM_NONREPARENTING" . #t)
+ ("LITERAL_VALUE" . ,(literal-string "$@{abc@}"))))
@end lisp
If you include such a service in you home environment definition, it
@@ -41021,11 +41023,17 @@ will add the following content to the @file{setup-environment} script
(which is expected to be sourced by the login shell):
@example
-export LESSHISTFILE=$XDG_CACHE_HOME/.lesshst
-export SHELL=/gnu/store/2hsg15n644f0glrcbkb1kqknmmqdar03-zsh-5.8/bin/zsh
+export LESSHISTFILE="$XDG_CACHE_HOME/.lesshst"
+export SHELL="/gnu/store/2hsg15n644f0glrcbkb1kqknmmqdar03-zsh-5.8/bin/zsh"
export _JAVA_AWT_WM_NONREPARENTING
+export LITERAL_VALUE='$@{abc@}'
@end example
+Notice that @code{literal-string} above lets us declare that a value is
+to be interpreted as a @dfn{literal string}, meaning that ``special
+characters'' such as the dollar sign will not be interpreted by the
+shell.
+
@quotation Note
Make sure that module @code{(gnu packages shells)} is imported with
@code{use-modules} or any other way, this namespace contains the