help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Defining thunderbolt service


From: phodina
Subject: Defining thunderbolt service
Date: Tue, 03 Aug 2021 20:45:52 +0000

Hello,
last month I submitted a patch to add support for thunderbolt devices [1]. The 
package, however, contains also a daemon that has to run.

So the after creating the package I focused on the services. I read the section 
of GuixSD documentation [2] as well as the contents of the =gnu/services= 
directory.

Below you can review the code for the thunderbolt service. The derivation is 
successful, but the service does not start. I'm kind of stuck on this and don't 
know how to finish the service at the moment.

In the documentation nor the manual for Shepherd [3] have I found a way to 
debug it.
I thought to run the Guile REPL and run =(use-modules (thunderbolt))= but then 
I didn't know what to to next.

For the packages I can run =guix build -L <MY_CHANNEL> <PKG> -K -v3= and I'll 
get the debug output and also the build directory stays in case of failure.

I'm missing something similar for the services - the derivation as well as 
runtime. I'm familiar with the systemd, where by running =journalctl -u 
<SERVICE>= I get the logs.
Is something similar available? Also do I have to build the service by running 
=guix system reconfigure os.scm=?

I'm able to get basic info from =herd status <SERVICE>=. Though, it's hard to 
know the reason the service failed to run without logs.

Also I'm not that familiar with DBUS and Polkit. Any suggestions for 
integrating the configuration files from the package into service definition 
would be appreciated!

Kind regards
Petr

[1]: https://lists.gnu.org/archive/html/guix-patches/2021-07/msg01299.html
[2]: https://guix.gnu.org/manual/en/html_node/Services.html
[3]: https://www.gnu.org/software/shepherd/manual/shepherd.html

------------------------------------------------------------------------------------------

(

define-module

(

bolt

)

#

:use-module

(

gnu

services

)

#

:use-module

(

gnu

services

base

)

#

:use-module

(

gnu

services

shepherd

)

#

:use-module

(

expanse

packages

thunderbolt

)

#

:use-module

(

guix

gexp

)

#

:use-module

(

guix

modules

)

#

:use-module

(

guix

records

)

#

:use-module

(

ice-9

match

)

#

:export

(

bolt-configuration

bolt-configuration?

bolt-service-type

))

(

define-record-type*

<bolt-configuration>

bolt-configuration

make-bolt-configuration

bolt-configuration?

(

package

bolt-configuration-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-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

shepherd-root-service-type

(

compose

list

bolt-shepherd-service

))))

(

default-value

(

bolt-configuration

))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]