From: phodina via Guix-patches via <guix-patches@gnu.org>
To: Sarah Morgensen <iskarian@mgsn.dev>
Cc: 49578@debbugs.gnu.org
Subject: [bug#49578] [PATCH v3 2/2] services: Add a service for bolt.
Date: Sat, 18 Sep 2021 11:21:34 +0000 [thread overview]
Message-ID: <7hJPvaldH4Bh7rtXByW9GPmxh-s8a1TCz9icV0mkcF6MLy5zRWlgrcruWWbl2KcenTOrIsL89cDh36eBRLrjKa6y53p8a8weWTQpSenjCHE=@protonmail.com> (raw)
In-Reply-To: <M1akxhPbhdsagfKtQNdUvQ_gr7_am4nX--PrR6Q_xlyvSCkuUoDtFRURxw8xHioONjC36RuHVt-wy18yvV-EeegHIEOUos87NROWijau444=@protonmail.com>
* gnu/services/linux.scm (bolt-service-type)
(bolt-shepherd-service, bolt-dbus-service)
(bolt-configuration, bolt-configuration?): New procedures.
diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm
index 2eb02ac5a3..dc26f285bf 100644
--- a/gnu/services/linux.scm
+++ b/gnu/services/linux.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com>
;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,7 +25,9 @@
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (guix modules)
+ #:use-module (gnu system shadow)
#:use-module (gnu services)
+ #:use-module (gnu services dbus)
#:use-module (gnu services base)
#:use-module (gnu services shepherd)
#:use-module (gnu packages linux)
@@ -33,7 +36,11 @@
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
- #:export (earlyoom-configuration
+ #:export (bolt-configuration
+ bolt-configuration?
+ bolt-service-type
+
+ earlyoom-configuration
earlyoom-configuration?
earlyoom-configuration-earlyoom
earlyoom-configuration-minimum-available-memory
@@ -61,6 +68,76 @@
zram-device-configuration-priority
zram-device-service-type))
+
+;;;
+;;; Thunderbolt daemon.
+;;;
+
+(define-record-type* <bolt-configuration>
+ bolt-configuration make-bolt-configuration bolt-configuration?
+ (package bolt-configuration-package ; package
+ (default bolt)))
+
+(define bolt-shepherd-service
+ (match-lambda
+ (($ <bolt-configuration> package)
+ (with-imported-modules (source-module-closure
+ '((gnu build shepherd)))
+ (shepherd-service
+ (documentation "Thunderbolt daemon")
+ (provision '(thunderbolt))
+ (requirement '(networking))
+ (modules '((gnu build shepherd)))
+ (start #~(make-forkexec-constructor/container
+ (list #$(file-append package "/libexec/boltd"))
+ ))
+ (stop #~(make-kill-destructor)))))))
+
+(define %bolt-activation
+ #~(begin
+ (use-modules (guix build utils))
+ (mkdir-p "/var/lib/boltd")))
+
+(define (bolt-dbus-service config)
+ (list (wrapped-dbus-service (bolt-configuration-bolt config)
+ "libexec/boltd"
+ `(("BOLT_CONF_FILE_NAME"
+ '("share/dbus-1/interfaces/org.freedesktop.bolt.xml"))))))
+
+(define %bolt-accounts
+ (list (user-group (name "boltd") (system? #t))
+ (user-account
+ (name "boltd")
+ (group "boltd")
+ (system? #t)
+ (comment "Boltd daemon user")
+ (home-directory "/var/empty")
+ (shell "/run/current-system/profile/sbin/nologin"))))
+
+(define bolt-udev-rule
+ (match-lambda
+ (($ <bolt-configuration> package)
+ (file->udev-rule "90-bolt.rules" (file-append package "/lib/udev/rules.d/90-bolt.rules")))))
+
+(define bolt-service-type
+ (service-type
+ (name 'boltd)
+ (description
+ "Thunderbolt daemon")
+ (extensions
+ (list (service-extension udev-service-type
+ (compose list bolt-udev-rule))
+ (service-extension activation-service-type
+ (const %bolt-activation))
+ (service-extension dbus-root-service-type
+ (compose list bolt-configuration-package))
+ ; bolt-dbus-service)
+ (service-extension account-service-type
+ (const %bolt-accounts))
+ (service-extension shepherd-root-service-type
+ (compose list bolt-shepherd-service))))
+ (default-value (bolt-configuration))))
+
;;;
;;; Early OOM daemon.
--
2.32.0
next prev parent reply other threads:[~2021-09-18 11:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 16:46 [bug#49578] [PATCH] Add bolt phodina via Guix-patches via
2021-07-22 1:50 ` Sarah Morgensen
2021-07-22 11:32 ` phodina via Guix-patches via
2021-07-22 11:36 ` phodina via Guix-patches via
2021-07-22 20:02 ` Sarah Morgensen
2021-09-18 11:20 ` [bug#49578] [PATCH v3 1/2] gnu: " phodina via Guix-patches via
2021-09-23 1:11 ` Sarah Morgensen
2021-11-05 8:39 ` phodina via Guix-patches via
2022-08-14 22:00 ` [bug#49578] [PATCH v4] " phodina via Guix-patches via
2022-12-14 11:22 ` [bug#49578] [PATCH] " Ludovic Courtès
2023-01-05 21:28 ` Ludovic Courtès
2023-01-10 2:49 ` phodina via Guix-patches via
2021-09-18 11:21 ` phodina via Guix-patches via [this message]
2022-01-22 6:55 ` David Conner
2022-02-02 16:19 ` David Conner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='7hJPvaldH4Bh7rtXByW9GPmxh-s8a1TCz9icV0mkcF6MLy5zRWlgrcruWWbl2KcenTOrIsL89cDh36eBRLrjKa6y53p8a8weWTQpSenjCHE=@protonmail.com' \
--to=guix-patches@gnu.org \
--cc=49578@debbugs.gnu.org \
--cc=iskarian@mgsn.dev \
--cc=phodina@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.