aboutsummaryrefslogtreecommitdiff
path: root/gnu/services.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/services.scm')
-rw-r--r--gnu/services.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index 832d6984d8..126e0814eb 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -632,6 +632,23 @@ and FILE could be \"/usr/bin/env\"."
(files->etc-directory (service-value service)))
(define (files->etc-directory files)
+ (define (assert-no-duplicates files)
+ (let loop ((files files)
+ (seen (set)))
+ (match files
+ (() #t)
+ (((file _) rest ...)
+ (when (set-contains? seen file)
+ (raise (condition
+ (&message
+ (message (format #f (G_ "duplicate '~a' entry for /etc")
+ file))))))
+ (loop rest (set-insert file seen))))))
+
+ ;; Detect duplicates early instead of letting them through, eventually
+ ;; leading to a build failure of "etc.drv".
+ (assert-no-duplicates files)
+
(file-union "etc" files))
(define (etc-entry files)