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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74120 in the body.
You can then email your comments to 74120 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#74120; Package guix-patches. (Wed, 30 Oct 2024 19:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roman Scherer <roman <at> burningswell.com>:
New bug report received and forwarded. Copy sent to efraim <at> flashner.co.il, guix-patches <at> gnu.org. (Wed, 30 Oct 2024 19:42:02 GMT) Full text and rfc822 format available.

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

From: Roman Scherer <roman <at> burningswell.com>
To: guix-patches <at> gnu.org
Cc: Roman Scherer <roman <at> burningswell.com>
Subject: [PATCH] gnu: Add rust-speakersafetyd-1.
Date: Wed, 30 Oct 2024 20:41:16 +0100
* gnu/packages/crates-io.scm (rust-speakersafetyd-1): New variable.

Change-Id: I02eb6e0c23fd04cff86b67ed30e8867af07a724b
---
 gnu/packages/crates-io.scm | 55 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index c08ccd29fd..83b543f552 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -73271,6 +73271,61 @@ (define-public rust-sourcemap-6
     (description "This package provides basic sourcemap handling for Rust.")
     (license license:bsd-3)))
 
+(define-public rust-speakersafetyd-1
+  (package
+    (name "rust-speakersafetyd")
+    (version "1.0.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "speakersafetyd" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1dvyj194niz5i4rldsqvjmz8j7df9w9qpvf9rwg3vsnzc2mjh0zg"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs (("rust-alsa" ,rust-alsa-0.8)
+                       ("rust-chrono" ,rust-chrono-0.4)
+                       ("rust-clap" ,rust-clap-4)
+                       ("rust-clap-verbosity-flag" ,rust-clap-verbosity-flag-2)
+                       ("rust-configparser" ,rust-configparser-3)
+                       ("rust-json" ,rust-json-0.12)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-log" ,rust-log-0.4)
+                       ("rust-signal-hook" ,rust-signal-hook-0.3)
+                       ("rust-simple-logger" ,rust-simple-logger-1))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-paths
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "src/main.rs"
+               (("share/speakersafetyd") "share")
+               (("/usr/local") (assoc-ref outputs "out")))))
+         (add-after 'unpack 'remove-systemd-udev-rules
+           (lambda _
+             (substitute* "95-speakersafetyd.rules"
+               ((".*SYSTEMD_WANTS.*") ""))))
+         (add-after 'install 'install-conf
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((target (string-append (assoc-ref outputs "out") "/share")))
+               (copy-recursively "conf" target))))
+         (add-after 'install 'install-udev-rules
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/lib/udev/rules.d"))
+               (copy-file "95-speakersafetyd.rules"
+                          (string-append out
+                                         "/lib/udev/rules.d/"
+                                         "95-speakersafetyd.rules"))))))))
+    (inputs (list alsa-lib))
+    (native-inputs (list pkg-config))
+    (home-page "https://github.com/AsahiLinux/speakersafetyd/")
+    (synopsis "Speaker protection daemon")
+    (description "Speakersafetyd is a userspace daemon written in Rust that
+implements an analogue of the Texas Instruments Smart Amp speaker protection
+model.")
+    (license license:expat)))
+
 (define-public rust-special-0.8
   (package
     (name "rust-special")

base-commit: d6f775c30c6f47e174f6110d1089edc6315600e4
-- 
2.46.0





Added tag(s) easy. Request was from Nicolas Graves <ngraves <at> ngraves.fr> to control <at> debbugs.gnu.org. (Sun, 03 Nov 2024 20:45:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#74120; Package guix-patches. (Sun, 03 Nov 2024 20:49:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: Roman Scherer <roman <at> burningswell.com>, 74120 <at> debbugs.gnu.org
Cc: Roman Scherer <roman <at> burningswell.com>,
 Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: [bug#74120] [PATCH] gnu: Add rust-speakersafetyd-1.
Date: Sun, 03 Nov 2024 21:48:27 +0100
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!

-- 
Best regards,
Nicolas Graves




Information forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#74120; Package guix-patches. (Wed, 06 Nov 2024 17:10:01 GMT) Full text and rfc822 format available.

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

From: Roman Scherer <roman <at> burningswell.com>
To: 74120 <at> debbugs.gnu.org
Cc: Roman Scherer <roman <at> burningswell.com>
Subject: [PATCH v2] gnu: Add rust-speakersafetyd-1.
Date: Wed,  6 Nov 2024 18:08:42 +0100
* gnu/packages/crates-io.scm (rust-speakersafetyd-1): New variable.

Change-Id: I02eb6e0c23fd04cff86b67ed30e8867af07a724b
---
 gnu/packages/crates-io.scm | 52 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index c08ccd29fd..22b28e0845 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -73271,6 +73271,58 @@ (define-public rust-sourcemap-6
     (description "This package provides basic sourcemap handling for Rust.")
     (license license:bsd-3)))
 
+(define-public rust-speakersafetyd-1
+  (package
+    (name "rust-speakersafetyd")
+    (version "1.0.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "speakersafetyd" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1dvyj194niz5i4rldsqvjmz8j7df9w9qpvf9rwg3vsnzc2mjh0zg"))))
+    (build-system cargo-build-system)
+    (arguments
+     (list
+      #:cargo-inputs `(("rust-alsa" ,rust-alsa-0.8)
+                       ("rust-chrono" ,rust-chrono-0.4)
+                       ("rust-clap" ,rust-clap-4)
+                       ("rust-clap-verbosity-flag" ,rust-clap-verbosity-flag-2)
+                       ("rust-configparser" ,rust-configparser-3)
+                       ("rust-json" ,rust-json-0.12)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-log" ,rust-log-0.4)
+                       ("rust-signal-hook" ,rust-signal-hook-0.3)
+                       ("rust-simple-logger" ,rust-simple-logger-1))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-paths
+            (lambda _
+              (substitute* "src/main.rs"
+                (("/usr/local") #$output))))
+          (add-after 'unpack 'remove-systemd-udev-rules
+            (lambda _
+              (substitute* "95-speakersafetyd.rules"
+                ((".*SYSTEMD_WANTS.*") ""))))
+          (add-after 'install 'install-data
+            (lambda _
+              (setenv "BINDIR" (string-append #$output "/bin"))
+              (setenv "UNITDIR" (string-append #$output "/lib/systemd/system"))
+              (setenv "UDEVDIR" (string-append #$output "/lib/udev/rules.d"))
+              (setenv "TMPFILESDIR" (string-append #$output "/usr/lib/tmpfiles.d"))
+              (setenv "SHAREDIR" (string-append #$output "/usr/share"))
+              (setenv "VARDIR" (string-append #$output "/var"))
+              (invoke "make" "install-data"))))))
+    (inputs (list alsa-lib))
+    (native-inputs (list pkg-config))
+    (home-page "https://github.com/AsahiLinux/speakersafetyd/")
+    (synopsis "Speaker protection daemon")
+    (description "Speakersafetyd is a userspace daemon written in Rust that
+implements an analogue of the Texas Instruments Smart Amp speaker protection
+model.")
+    (license license:expat)))
+
 (define-public rust-special-0.8
   (package
     (name "rust-special")

base-commit: 54f82bcf22178d89140a131332a9e036ac386657
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#74120; Package guix-patches. (Wed, 06 Nov 2024 17:17:02 GMT) Full text and rfc822 format available.

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)]

Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Tue, 03 Dec 2024 19:48:02 GMT) Full text and rfc822 format available.

Notification sent to Roman Scherer <roman <at> burningswell.com>:
bug acknowledged by developer. (Tue, 03 Dec 2024 19:48:03 GMT) Full text and rfc822 format available.

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

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Roman Scherer <roman <at> burningswell.com>
Cc: 74120-done <at> debbugs.gnu.org
Subject: Re: [bug#74120] [PATCH v2] gnu: Add rust-speakersafetyd-1.
Date: Tue, 3 Dec 2024 21:46:13 +0200
[Message part 1 (text/plain, inline)]
I renamed the package to speakersafetyd and moved it to rust-apps.

Patch pushed to the rust-team branch!

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#74120; Package guix-patches. (Wed, 04 Dec 2024 07:57:02 GMT) Full text and rfc822 format available.

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

From: Roman Scherer <roman <at> burningswell.com>
To: Efraim Flashner <efraim <at> flashner.co.il>,
 Roman Scherer <roman <at> burningswell.com>, 74120-done <at> debbugs.gnu.org
Subject: Re: [bug#74120] [PATCH v2] gnu: Add rust-speakersafetyd-1.
Date: Wed, 4 Dec 2024 08:55:37 +0100
[Message part 1 (text/plain, inline)]
Thank you Efraim!

On Tue, Dec 3, 2024, 20:46 Efraim Flashner <efraim <at> flashner.co.il> wrote:

> I renamed the package to speakersafetyd and moved it to rust-apps.
>
> Patch pushed to the rust-team branch!
>
> --
> Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
> GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
> Confidentiality cannot be guaranteed on emails sent or received unencrypted
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 01 Jan 2025 12:24:06 GMT) Full text and rfc822 format available.

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.