GNU bug report logs - #74120
[PATCH] gnu: Add rust-speakersafetyd-1.

Previous Next

Package: guix-patches;

Reported by: Roman Scherer <roman <at> burningswell.com>

Date: Wed, 30 Oct 2024 19:42:02 UTC

Severity: normal

Tags: easy, patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 74120 <at> debbugs.gnu.org (full text, mbox):

From: Roman Scherer <roman <at> burningswell.com>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: Roman Scherer <roman <at> burningswell.com>, 74120 <at> debbugs.gnu.org,
 Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: [bug#74120] [PATCH] gnu: Add rust-speakersafetyd-1.
Date: Wed, 06 Nov 2024 18:15:04 +0100
[Message part 1 (text/plain, inline)]
Nicolas Graves <ngraves <at> ngraves.fr> writes:

Hi Nicolas,

thanks for the review. I sent a v2 where I now use g-expressions and use
the install-data target from the Makefile to install files.

I tested this with this speakersafteyd service which I'm going to send
soon as well. I paste it here to maybe double check the paths I plan to
use in the service.

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

(define-module (asahi guix services speakersafetyd)
  #:use-module (asahi guix packages crates-io)
  #:use-module (gnu services base)
  #:use-module (gnu services shepherd)
  #:use-module (gnu services)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:export (speakersafetyd-service-type))

(define-record-type* <speakersafetyd-configuration>
  speakersafetyd-configuration
  make-speakersafetyd-configuration
  speakersafetyd-configuration?
  (config-path speakersafetyd-configuration-config-path
               (default "/usr/share/speakersafetyd"))
  (blackbox speakersafetyd-configuration-blackbox
            (default "/var/lib/speakersafetyd/blackbox"))
  (max-reduction speakersafetyd-configuration-max-reduction
                 (default 7))
  (package speakersafetyd-configuration-package
           (default rust-speakersafetyd-1)))

(define (speakersafetyd-shepherd-service config)
  (let ((blackbox (speakersafetyd-configuration-blackbox config))
        (config-path (speakersafetyd-configuration-config-path config))
        (max-reduction (speakersafetyd-configuration-max-reduction config))
        (package (speakersafetyd-configuration-package config)))
    (list (shepherd-service
           (documentation "Speaker saftey daemon")
           (provision '(speakersafetyd))
           (requirement '(udev))
           (start #~(make-forkexec-constructor
                     (list #$(file-append package "/bin/speakersafetyd")
                           "--config-path" #$(file-append package config-path)
                           "--blackbox-path" #$blackbox
                           "--max-reduction" (number->string #$max-reduction))))
           (stop #~(make-kill-destructor))))))

(define speakersafetyd-service-type
  (service-type
   (name 'speakersafetyd)
   (description "Speaker saftey daemon")
   (extensions
    (list (service-extension
           profile-service-type
           (compose list speakersafetyd-configuration-package))
          (service-extension
           shepherd-root-service-type
           speakersafetyd-shepherd-service)
          (service-extension
           udev-service-type
           (compose list speakersafetyd-configuration-package))))
   (default-value (speakersafetyd-configuration))))

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

Could you have another look, please?

Thanks, Roman.

> Hi Roman,
>
> Just so you know, you can probably use gexpressions for the phases, this
> would make it easier to read.
>
> Can you resend a revised patch?  Thanks!
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.