[PATCH 0/1] Add batsignal package

  • Done
  • quality assurance status badge
Details
5 participants
  • Liliana Marie Prikler
  • Ludovic Courtès
  • M
  • Maxime Devos
  • (
Owner
unassigned
Submitted by
M
Severity
normal
M
(address . guix-patches@gnu.org)(name . M)(address . matf@disr.it)
20220911134305.14581-1-matf@disr.it
batsignal can send desktop notifications at set battery levels, and can run a
command when the battery level gets dangerously low. This can be used to force
powering off a laptop when battery gets below critical levels, instead of
damaging the battery.

M (1):
gnu: Add batsignal.

gnu/packages/monitoring.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

--
2.37.2
M
[PATCH 1/1] gnu: Add batsignal.
(address . 57731@debbugs.gnu.org)(name . M)(address . matf@disr.it)
20220911134734.16642-1-matf@disr.it
* gnu/packages/monitoring.scm (batsignal): New variable.
---
gnu/packages/monitoring.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (58 lines)
diff --git a/gnu/packages/monitoring.scm b/gnu/packages/monitoring.scm
index 47845700ee..bccf03ae06 100644
--- a/gnu/packages/monitoring.scm
+++ b/gnu/packages/monitoring.scm
@@ -12,6 +12,8 @@
;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2022 ( <paren@disroot.org>
+;;; Copyright © 2022 Mathieu Laparie <mlaparie@disr.it>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -50,6 +52,7 @@ (define-module (gnu packages monitoring)
#:use-module (gnu packages django)
#:use-module (gnu packages gd)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages gnome)
#:use-module (gnu packages image)
#:use-module (gnu packages mail)
#:use-module (gnu packages ncurses)
@@ -764,3 +767,34 @@ (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 #:tests? #f ;; batsignal's tests depend on docker
+ #:phases
+ #~(modify-phases %standard-phases (delete 'configure))
+ #:make-flags
+ #~(list (string-append "PREFIX=" #$output)
+ (string-append "CC=" #$(cc-for-target)))))
+ (inputs (list libnotify))
+ (native-inputs (list pkg-config))
+ (home-page "https://github.com/electrickite/batsignal")
+ (synopsis "Simple 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.")
+ (license license:isc)))
--
2.37.2
L
L
Liliana Marie Prikler wrote on 11 Sep 2022 16:02
aa87693ca23e9f15f6a5f9dd994c77f9fe980c0a.camel@gmail.com
Hi

Am Sonntag, dem 11.09.2022 um 15:47 +0200 schrieb M:
Toggle quote (16 lines)
> * gnu/packages/monitoring.scm (batsignal): New variable.
> ---
>  gnu/packages/monitoring.scm | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/gnu/packages/monitoring.scm
> b/gnu/packages/monitoring.scm
> index 47845700ee..bccf03ae06 100644
> --- a/gnu/packages/monitoring.scm
> +++ b/gnu/packages/monitoring.scm
> @@ -12,6 +12,8 @@
>  ;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
>  ;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
>  ;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
> +;;; Copyright © 2022 ( <paren@disroot.org>
> +;;; Copyright © 2022 Mathieu Laparie <mlaparie@disr.it>
Did you two co-author the patch? If so, add a "Co-authored-by" trailer
to the commit message. Also, your copyright mail does not match the
sender, you may want to fix that.
Toggle quote (35 lines)
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -50,6 +52,7 @@ (define-module (gnu packages monitoring)
>    #:use-module (gnu packages django)
>    #:use-module (gnu packages gd)
>    #:use-module (gnu packages gettext)
> +  #:use-module (gnu packages gnome)
>    #:use-module (gnu packages image)
>    #:use-module (gnu packages mail)
>    #:use-module (gnu packages ncurses)
> @@ -764,3 +767,34 @@ (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 #:tests? #f ;; batsignal's tests depend on docker
The test appears to be running "batsignal -v", which we could do in the
build container as well.
Toggle quote (2 lines)
> +           #:phases
> +           #~(modify-phases %standard-phases (delete 'configure))
By convention #:phases is the last argument to set.
Toggle quote (7 lines)
> +           #:make-flags
> +           #~(list (string-append "PREFIX=" #$output)
> +                   (string-append "CC=" #$(cc-for-target)))))
> +    (inputs (list libnotify))
> +    (native-inputs (list pkg-config))
> +    (home-page "https://github.com/electrickite/batsignal")
> +    (synopsis "Simple power monitoring tool")
"Power monitoring tool"
Toggle quote (5 lines)
> +    (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.")
> +    (license license:isc)))
Cheers.
M
M
Maxime Devos wrote on 11 Sep 2022 16:31
Re: [bug#57731] [PATCH 1/1] gnu: Add batsignal.
69940359-33ee-9423-9057-8f961b590662@telenet.be
On 11-09-2022 15:47, M wrote:
Toggle quote (8 lines)
> + (arguments
> + (list #:tests? #f ;; batsignal's tests depend on docker
> + #:phases
> + #~(modify-phases %standard-phases (delete 'configure))
> + #:make-flags
> + #~(list (string-append "PREFIX=" #$output)
> + (string-append "CC=" #$(cc-for-target)))))
> + (inputs (list libnotify))
The makefile uses pkg-config. However, when cross-compiling,
TARGET-pkg-config is required instead. To solve this, you will need to
'substitute*' pkg-config to #$(pkg-config-for-target). For an example,
see opensmtpd-filter-dkimsign.
(Unfortunately the dependency libtirpc is not yet cross-compilable ...)
Greetings,
Maxime.
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 11 Sep 2022 16:34
Re: [bug#57731] [PATCH 0/1] Add batsignal package
1f3a41ea-cd8e-8d5a-e092-0c81c3b9d3ad@telenet.be
On 11-09-2022 15:43, M wrote:
Toggle quote (4 lines)
> batsignal can send desktop notifications at set battery levels, and can run a
> command when the battery level gets dangerously low. This can be used to force
> powering off a laptop when battery gets below critical levels, instead of
> damaging the battery.
This looks like a good description to me, can you integrate the 'This
can be used to force powering off a laptop when the battery gets below
critical levels, instead of damaging the battery’ in the package
description? It seems like a widely useful and simple example usage.
Greetings,
Maxime.
Attachment: OpenPGP_signature
M
[PATCH v2] gnu: Add batsignal.
(address . 57731@debbugs.gnu.org)(name . M)(address . matf@disr.it)
20220911161213.12192-1-matf@disr.it
* gnu/packages/monitoring.scm (batsignal): New variable.
Co-authored by unmatched-paren and matf
---
gnu/packages/monitoring.scm | 45 +++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/monitoring.scm b/gnu/packages/monitoring.scm
index 47845700ee..459b8d8539 100644
--- a/gnu/packages/monitoring.scm
+++ b/gnu/packages/monitoring.scm
@@ -12,6 +12,8 @@
;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2022 ( <paren@disroot.org>
+;;; Copyright © 2022 Mathieu Laparie <mlaparie@disr.it>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -50,6 +52,7 @@ (define-module (gnu packages monitoring)
#:use-module (gnu packages django)
#:use-module (gnu packages gd)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages gnome)
#:use-module (gnu packages image)
#:use-module (gnu packages mail)
#:use-module (gnu packages ncurses)
@@ -764,3 +767,45 @@ (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)))
--
2.37.2
M
[PATCH 1/1] gnu: Add batsignal.
(address . 57731@debbugs.gnu.org)(name . M)(address . matf@disr.it)
20220911191636.5369-1-matf@disr.it
* gnu/packages/monitoring.scm (batsignal): New variable.
Co-authored-by: ( <paren@disroot.org>
---
gnu/packages/monitoring.scm | 45 +++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/monitoring.scm b/gnu/packages/monitoring.scm
index 47845700ee..7f665e931f 100644
--- a/gnu/packages/monitoring.scm
+++ b/gnu/packages/monitoring.scm
@@ -12,6 +12,8 @@
;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2022 ( <paren@disroot.org>
+;;; Copyright © 2022 Mathieu Laparie <mlaparie@disr.it>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -50,6 +52,7 @@ (define-module (gnu packages monitoring)
#:use-module (gnu packages django)
#:use-module (gnu packages gd)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages gnome)
#:use-module (gnu packages image)
#:use-module (gnu packages mail)
#:use-module (gnu packages ncurses)
@@ -764,3 +767,45 @@ (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)))
--
2.37.2
M
[PATCH v4] gnu: Add batsignal.
(address . 57731@debbugs.gnu.org)
20220911192905.13238-1-matf@disr.it
* gnu/packages/monitoring.scm (batsignal): New variable.

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

Toggle diff (53 lines)
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)))
+
--
2.37.2
(
M
[PATCH v5] gnu: Add batsignal.
(address . 57731@debbugs.gnu.org)
20220911194211.19915-1-matf@disr.it
* gnu/packages/monitoring.scm (batsignal): New variable.

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

Toggle diff (62 lines)
diff --git a/gnu/packages/monitoring.scm b/gnu/packages/monitoring.scm
index 47845700ee..8f75eacf9e 100644
--- a/gnu/packages/monitoring.scm
+++ b/gnu/packages/monitoring.scm
@@ -12,6 +12,8 @@
;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2022 ( <paren@disroot.org>
+;;; Copyright © 2022 Mathieu Laparie <mlaparie@disr.it>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -764,3 +766,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)))
+
--
2.37.2
L
L
Ludovic Courtès wrote on 24 Sep 2022 15:56
Re: bug#57731: [PATCH 0/1] Add batsignal package
(name . M)(address . matf@disr.it)
87pmfk98pp.fsf_-_@gnu.org
Hi,

M <matf@disr.it> skribis:

Toggle quote (4 lines)
> * gnu/packages/monitoring.scm (batsignal): New variable.
>
> Co-authored-by: ( <paren@disroot.org>

There was one missing #:use-module (gnu packages gnome), which I added.

Applied. Thanks Mathieu, and thanks paren for reviewing!

Ludo’.
Closed
M
M
Mathieu wrote on 24 Sep 2022 16:00
(name . Ludovic Courtès)(address . ludo@gnu.org)
6ed760cc-4cd0-4fc2-9155-2e59ded86d0a@disroot.org
Thanks all, glad to see this merged!

On 2022-09-24 15:56 Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (14 lines)
> Hi,
>
> M <matf@disr.it> skribis:
>
>> * gnu/packages/monitoring.scm (batsignal): New variable.
>>
>> Co-authored-by: ( <paren@disroot.org>
>
> There was one missing #:use-module (gnu packages gnome), which I
> added.
>
> Applied. Thanks Mathieu, and thanks paren for reviewing!
>
> Ludo’.
Closed
?