From d298c815e638581d466222f3a883b280f019b368 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Oct 2017 10:12:53 +0200 Subject: 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. --- guix/gexp.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'guix/gexp.scm') 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. -- cgit v1.2.3