Subject: [PATCH v2 05/15] gnu: dart.scm: Add helper function.

From: nixo <[email-masked]>
Date: Sun, 29 Nov 2020 18:34:04 +0100

* gnu/packages/dart.scm (replace-inputs): New function.
---
 gnu/packages/dart.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gnu/packages/dart.scm b/gnu/packages/dart.scm
index c2463a676c..20da998b49 100644
--- a/gnu/packages/dart.scm
+++ b/gnu/packages/dart.scm
@@ -22,6 +22,9 @@
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix utils)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
+  #:use-module ((guix build utils) #:select (alist-replace))
   #:use-module (gnu packages)
   #:use-module (gnu packages build-tools)
   #:use-module (gnu packages gcc)
@@ -487,3 +490,12 @@
     (native-inputs
      (cons `("dart" ,dart-2.0.0-dev.8.0)
            (package-native-inputs dart-2.0.0-dev.8.0)))))
+
+(define (replace-inputs pkg inputs)
+  "Replace multiple inputs at once.  `PKG' is the source package and
+`INPUTS' the list of replacements."
+  (fold (lambda (pkg inputs)
+          (match-let (((name pkg) pkg))
+            (alist-replace name (list pkg) inputs)))
+        (package-inputs pkg)
+        inputs))
-- 
2.29.2