Subject: [bug#50873] [PATCH v3 5/8] guix home: import: Delete duplicate modules when importing.

From: Xinglu Chen <[email-masked]>
Date: Sat, 30 Oct 2021 12:42:37 +0200

Two different services might require the same module(s), so delete duplicates
when generating the ‘use-modules’ form.

* import.scm (manifest->code): Delete duplicate modules.
---
 guix/scripts/home/import.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm
index 0e7c454f45..f0ae233b75 100644
--- a/guix/scripts/home/import.scm
+++ b/guix/scripts/home/import.scm
@@ -145,7 +145,8 @@ (define (qualified-name entry)
                  (use-modules (gnu home)
                               (gnu packages)
                               (gnu services)
-                              ,@(concatenate (map cdr configurations+modules)))
+                              ,@((compose delete-duplicates concatenate)
+                                 (map cdr configurations+modules)))
                  ,(home-environment-template
                    #:specs specs
                    #:services (map first configurations+modules))))
@@ -190,7 +191,8 @@ (define name
                               (gnu home)
                               (gnu packages)
                               (gnu services)
-                              ,@(concatenate (map cdr configurations+modules)))
+                              ,@((compose delete-duplicates concatenate)
+                                 (map cdr configurations+modules)))
 
                  ,@transformations
 
-- 
2.33.0