summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r--guix/gexp.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 9835599bb8..b9525603ee 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -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.