@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
-;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2022, 2024 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -67,7 +67,8 @@ (define-record-type* <home-environment> home-environment
this-home-environment)))
(services home-environment-user-services
- (default '()))
+ (default '())
+ (sanitize validate-service-list))
(location home-environment-location ; <location>
(default (and=> (current-source-location)
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015-2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015-2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
@@ -91,6 +91,8 @@ (define-module (gnu services)
for-home
for-home?
+ validate-service-list
+
service-error?
missing-value-service-error?
missing-value-service-error-type
@@ -1271,4 +1273,19 @@ (define-syntax-rule (for-home exp ...)
(syntax-parameterize ((for-home? (identifier-syntax #t)))
exp ...))
+(define-with-syntax-properties (validate-service-list (value properties))
+ (%validate-service-list value properties))
+
+(define (%validate-service-list value properties)
+ (match value
+ (((? service?) ...) value)
+ (_
+ (raise
+ (make-compound-condition
+ (condition
+ (&error-location
+ (location (source-properties->location properties))))
+ (formatted-message
+ (G_ "'services' field must contain a list of services")))))))
+
;;; services.scm ends here.
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2022, 2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
@@ -294,7 +294,8 @@ (define-record-type* <operating-system> operating-system
this-operating-system)))
(services operating-system-user-services ; list of services
(thunked) ;allow for system-dependent services
- (default %base-services))
+ (default %base-services)
+ (sanitize validate-service-list))
(pam-services operating-system-pam-services ; list of PAM services
(default (base-pam-services)))