diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-08-06 18:23:54 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-08-20 22:48:47 +0200 |
commit | dff7d2468ffe9d01b25662544af380e1794ac55a (patch) | |
tree | 2d4e5807009ffe7808175314eed8495402e1dbc2 | |
parent | c6c8106c65bc1edcbb67e4ccfdc81c01aa4afd5f (diff) | |
download | guix-dff7d2468ffe9d01b25662544af380e1794ac55a.tar guix-dff7d2468ffe9d01b25662544af380e1794ac55a.tar.gz |
services: Define 'for-home'.
* gnu/services.scm (remove-service-extensions): New procedure.
(for-home?): New syntax parameter.
(for-home): New macro.
-rw-r--r-- | gnu/services.scm | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gnu/services.scm b/gnu/services.scm index 109e050a23..eb9258977e 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015-2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015-2023 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> @@ -86,6 +86,10 @@ instantiate-missing-services fold-services + remove-service-extensions + for-home + for-home? + service-error? missing-value-service-error? missing-value-service-error-type @@ -1225,4 +1229,23 @@ TARGET-TYPE; return the root service adjusted accordingly." (G_ "more than one target service of type '~a'") (service-type-name target-type))))))))) +(define (remove-service-extensions type lst) + "Return TYPE, a service type, without any of the service extensions +targeting one of the types in LST." + (service-type + (inherit type) + (extensions (remove (lambda (extension) + (memq (service-extension-target extension) lst)) + (service-type-extensions type))))) + +(define-syntax-parameter for-home? + ;; Whether the configuration being defined is for a Home service. + (identifier-syntax #f)) + +(define-syntax-rule (for-home exp ...) + "Mark EXP, which typically defines a service configuration, as targeting a +Home service rather than a System service." + (syntax-parameterize ((for-home? (identifier-syntax #t))) + exp ...)) + ;;; services.scm ends here. |