diff mbox series

[bug#74120] gnu: Add rust-speakersafetyd-1.

Message ID 730badd0c62c83b9c779ee2ad9c9ca41af34bfd9.1730317218.git.roman@burningswell.com
State New
Headers show
Series [bug#74120] gnu: Add rust-speakersafetyd-1. | expand

Commit Message

Roman Scherer Oct. 30, 2024, 7:41 p.m. UTC
* gnu/packages/crates-io.scm (rust-speakersafetyd-1): New variable.

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


base-commit: d6f775c30c6f47e174f6110d1089edc6315600e4

Comments

Nicolas Graves Nov. 3, 2024, 8:48 p.m. UTC | #1
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!
diff mbox series

Patch

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