Browse Source
gexp: Add 'directory-union'.
* gnu/services.scm (directory-union): Move to...
* guix/gexp.scm (directory-union): ... here. New procedure.
* doc/guix.texi (G-Expressions): Document it.
version-0.14.0
Ludovic Courtès
5 years ago
No known key found for this signature in database
GPG Key ID: 90B11993D9AEBB5
3 changed files with
32 additions and
16 deletions
-
doc/guix.texi
-
gnu/services.scm
-
guix/gexp.scm
|
|
@ -5007,6 +5007,17 @@ denoting the target file. Here's an example: |
|
|
|
This yields an @code{etc} directory containing these two files. |
|
|
|
@end deffn |
|
|
|
|
|
|
|
@deffn {Scheme Procedure} directory-union @var{name} @var{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: |
|
|
|
|
|
|
|
@example |
|
|
|
(directory-union "guile+emacs" (list guile emacs)) |
|
|
|
@end example |
|
|
|
|
|
|
|
yields a directory that is the union of the @code{guile} and @code{emacs} packages. |
|
|
|
@end deffn |
|
|
|
|
|
|
|
@deffn {Scheme Procedure} file-append @var{obj} @var{suffix} @dots{} |
|
|
|
Return a file-like object that expands to the concatenation of @var{obj} |
|
|
|
and @var{suffix}, where @var{obj} is a lowerable object and each |
|
|
|
|
|
@ -95,9 +95,7 @@ |
|
|
|
|
|
|
|
%boot-service |
|
|
|
%activation-service |
|
|
|
etc-service |
|
|
|
|
|
|
|
directory-union)) |
|
|
|
etc-service)) |
|
|
|
|
|
|
|
;;; Comment: |
|
|
|
;;; |
|
|
@ -387,19 +385,6 @@ boot." |
|
|
|
(list (service-extension boot-service-type |
|
|
|
cleanup-gexp))))) |
|
|
|
|
|
|
|
(define (directory-union name things) |
|
|
|
"Return a directory that is the union of THINGS." |
|
|
|
(match things |
|
|
|
((one) |
|
|
|
;; Only one thing; return it. |
|
|
|
one) |
|
|
|
(_ |
|
|
|
(computed-file name |
|
|
|
(with-imported-modules '((guix build union)) |
|
|
|
#~(begin |
|
|
|
(use-modules (guix build union)) |
|
|
|
(union-build #$output '#$things))))))) |
|
|
|
|
|
|
|
(define* (activation-service->script service) |
|
|
|
"Return as a monadic value the activation script for SERVICE, a service of |
|
|
|
ACTIVATION-SCRIPT-TYPE." |
|
|
|
|
|
@ -79,6 +79,7 @@ |
|
|
|
text-file* |
|
|
|
mixed-text-file |
|
|
|
file-union |
|
|
|
directory-union |
|
|
|
imported-files |
|
|
|
imported-modules |
|
|
|
compiled-modules |
|
|
@ -1203,6 +1204,25 @@ This yields an 'etc' directory containing these two files." |
|
|
|
(ungexp target)))))) |
|
|
|
files)))))) |
|
|
|
|
|
|
|
(define (directory-union name things) |
|
|
|
"Return a directory that is the union of THINGS, where THINGS is a list of |
|
|
|
file-like objects denoting directories. For example: |
|
|
|
|
|
|
|
(directory-union \"guile+emacs\" (list guile emacs)) |
|
|
|
|
|
|
|
yields a directory that is the union of the 'guile' and 'emacs' packages." |
|
|
|
(match things |
|
|
|
((one) |
|
|
|
;; Only one thing; return it. |
|
|
|
one) |
|
|
|
(_ |
|
|
|
(computed-file name |
|
|
|
(with-imported-modules '((guix build union)) |
|
|
|
(gexp (begin |
|
|
|
(use-modules (guix build union)) |
|
|
|
(union-build (ungexp output) |
|
|
|
'(ungexp things))))))))) |
|
|
|
|
|
|
|
|
|
|
|
;;; |
|
|
|
;;; Syntactic sugar. |
|
|
|