[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/09: system, home: Validate ‘services’ field value.
From: |
guix-commits |
Subject: |
03/09: system, home: Validate ‘services’ field value. |
Date: |
Fri, 22 Mar 2024 06:43:01 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 29de2edfbbed21ac016f73a45d399795fc2e4dfb
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Feb 23 21:22:55 2024 +0100
system, home: Validate ‘services’ field value.
This guides newcomers who might stick a single (service …) form
in this field.
* gnu/services.scm (validate-service-list): New macro.
(%validate-service-list): New procedure.
* gnu/system.scm (<operating-system>)[services]: Add ‘sanitize’.
* gnu/home.scm (<home-environment>)[services]: Add ‘sanitize’.
Change-Id: I9e29bd9a078e87b627ab766fd669ba9de79f8473
---
gnu/home.scm | 5 +++--
gnu/services.scm | 19 ++++++++++++++++++-
gnu/system.scm | 5 +++--
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/gnu/home.scm b/gnu/home.scm
index 2fefe7ba53..b390c8d534 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -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 @@
this-home-environment)))
(services home-environment-user-services
- (default '()))
+ (default '())
+ (sanitize validate-service-list))
(location home-environment-location ; <location>
(default (and=> (current-source-location)
diff --git a/gnu/services.scm b/gnu/services.scm
index 59481af10f..88593e8091 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -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 @@
for-home
for-home?
+ validate-service-list
+
service-error?
missing-value-service-error?
missing-value-service-error-type
@@ -1271,4 +1273,19 @@ Home service rather than a System service."
(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.
diff --git a/gnu/system.scm b/gnu/system.scm
index aede35775e..aef81d8ccf 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -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 @@ VERSION is the target version of the boot-parameters
record."
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)))
- branch master updated (3d2966e0b7 -> 40f53e8fb5), guix-commits, 2024/03/22
- 02/09: doc: Mention channel files beyond ~/.config/guix., guix-commits, 2024/03/22
- 05/09: gnu: arcan-sdl: Add missing inputs., guix-commits, 2024/03/22
- 09/09: gnu: mu: Update to 1.12.2., guix-commits, 2024/03/22
- 03/09: system, home: Validate ‘services’ field value.,
guix-commits <=
- 01/09: services: guix: Add ‘channels’ field., guix-commits, 2024/03/22
- 04/09: gnu: mupdf: Update to 1.23.11., guix-commits, 2024/03/22
- 06/09: gnu: Add gvisor-tap-vsock., guix-commits, 2024/03/22
- 07/09: gnu: distrobox: Update to 1.7.0., guix-commits, 2024/03/22
- 08/09: gnu: distrobox: Fix dependency usage., guix-commits, 2024/03/22