diff options
author | Sergey Trofimov <sarg@sarg.org.ru> | 2025-05-19 11:50:09 +0200 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2025-05-21 08:05:27 +0900 |
commit | b989e503acc2e03a9be715da147046dd007c1ec3 (patch) | |
tree | 044a1712c09d6afecdf9367c1850b973ee4e06cc | |
parent | 9b7213fc11bdefb884c4c23d1e853ea92b40239f (diff) | |
download | guix-b989e503acc2e03a9be715da147046dd007c1ec3.tar.gz guix-b989e503acc2e03a9be715da147046dd007c1ec3.zip |
gexp: Add symlink-to procedure.
* guix/gexp.scm (symlink-to): New procedure.
* doc/guix.texi (G-Expressions): Document it.
Change-Id: I7c1ba3a29a4e5350cb4f196185b7171c4750b6b8
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-rw-r--r-- | doc/guix.texi | 11 | ||||
-rw-r--r-- | guix/gexp.scm | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index ef8504bb3e..02f472246a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12692,6 +12692,17 @@ file. Here's an example: This yields an @code{etc} directory containing these two files. @end deffn +@deffn {Procedure} symlink-to target +Return a @code{<computed-file>} that is a symbolic link to target. +Note, that the target does not need to exist at the build time. One of +uses is to put arbitrary symlinks into user's home: + +@lisp +(service home-files-service-type + `(("Sync" ,(symlink-to "/storage/Sync")))) +@end lisp +@end deffn + @deffn {Procedure} directory-union name things Return a directory that is the union of @var{things}, where @var{things} is a list of file-like objects denoting directories. For example: diff --git a/guix/gexp.scm b/guix/gexp.scm index 302a1bb553..cf94d9d5f4 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -119,6 +119,7 @@ file-union directory-union references-file + symlink-to imported-files imported-modules @@ -2182,6 +2183,10 @@ or dangling symlink ~a" target source))) files))))) #:guile guile)) +(define (symlink-to target) + "Return an object that is a symlink to TARGET." + (computed-file "link" (gexp (symlink (ungexp target) (ungexp output))))) + (define* (directory-union name things #:key (copy? #f) (quiet? #f) (resolve-collision 'resolve-collision/default)) |