diff mbox series

[bug#57731,v4] gnu: Add batsignal.

Message ID 20220911192905.13238-1-matf@disr.it
State Accepted
Headers show
Series [bug#57731,v4] gnu: Add batsignal. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Mathieu Sept. 11, 2022, 7:29 p.m. UTC
* gnu/packages/monitoring.scm (batsignal): New variable.

Co-authored-by: ( <paren@disroot.org>
---
 gnu/packages/monitoring.scm | 43 +++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

\( Sept. 11, 2022, 7:32 p.m. UTC | #1
LGTM!

    -- (
diff mbox series

Patch

diff --git a/gnu/packages/monitoring.scm b/gnu/packages/monitoring.scm
index 47845700ee..608973f9c2 100644
--- a/gnu/packages/monitoring.scm
+++ b/gnu/packages/monitoring.scm
@@ -764,3 +764,46 @@  (define-public python-statsd
     (description "StatsD is a friendly front-end to Graphite.  This package
 provides a simple Python client for the StatsD daemon.")
     (license license:expat)))
+
+(define-public batsignal
+  (package
+    (name "batsignal")
+    (version "1.6.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/electrickite/batsignal")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0b1j6mljnqgxwr3id3r9shzhsjk5r0qdh9cxkvy1dm4kzbyc4dxq"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:make-flags
+           #~(list (string-append "PREFIX=" #$output)
+                   (string-append "CC=" #$(cc-for-target)))
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'fix-cross-compile
+                 (lambda _
+                   (substitute* "Makefile"
+                     (("pkg-config")
+                      #$(pkg-config-for-target)))))
+               (delete 'configure)
+               (replace 'check
+                 (lambda* (#:key tests? #:allow-other-keys)
+                   (when tests?
+                     (invoke "./batsignal" "-v")))))))
+    (inputs (list libnotify))
+    (native-inputs (list pkg-config))
+    (home-page "https://github.com/electrickite/batsignal")
+    (synopsis "Power monitoring tool")
+    (description
+     "This package provides a daemon that monitors device power levels,
+notifying the user and optionally running a command when it reaches
+user-configured power thresholds.  This can be used to force powering off a
+laptop when the battery gets below critical levels, instead of damaging the
+battery.")
+    (license license:isc)))
+