summary refs log tree commit diff
path: root/distro
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-10-11 00:32:17 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-11 00:32:17 +0200
commite300a0f8d25cb309aa3fe9d1d78f6db74b625902 (patch)
tree68809e1e4871703d8ee4895d1e928baa95c23f5b /distro
parenta3f75312ec6fb170f2a60a80442a92648db1f5c2 (diff)
downloadguix-e300a0f8d25cb309aa3fe9d1d78f6db74b625902.tar.gz
distro: Add missing bits from previous commit.
* distro/packages/base.scm (default-keyword-arguments): New procedure.
Diffstat (limited to 'distro')
-rw-r--r--distro/packages/base.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/distro/packages/base.scm b/distro/packages/base.scm
index f2a93f8601..2fb67b62af 100644
--- a/distro/packages/base.scm
+++ b/distro/packages/base.scm
@@ -1388,6 +1388,20 @@ with the Linux kernel.")
   ;; The Guile used to run the build scripts of the initial derivations.
   (nixpkgs-derivation* "guile"))
 
+(define (default-keyword-arguments args defaults)
+  "Return ARGS augmented with any keyword/value from DEFAULTS for
+keywords not already present in ARGS."
+  (let loop ((defaults defaults)
+             (args     args))
+    (match defaults
+      ((kw value rest ...)
+       (loop rest
+             (if (assoc-ref kw args)
+                 args
+                 (cons* kw value args))))
+      (()
+       args))))
+
 (define-syntax substitute-keyword-arguments
   (syntax-rules ()
     "Return a new list of arguments where the value for keyword arg KW is