[PATCH] gnu: Add guix-send-email.

  • Done
  • quality assurance status badge
Details
5 participants
  • Efraim Flashner
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxime Devos
  • zimoun
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 20 Sep 2022 12:00
(address . guix-patches@gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
19f63e3d16273f9d43f61890b0c8472afaa75d3f.1663668015.git.efraim@flashner.co.il
* gnu/packages/guix-extensions.scm (guix-send-email): New variable.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add guix-extensions.
---
gnu/local.mk | 1 +
gnu/packages/guix-extensions.scm | 62 ++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
create mode 100644 gnu/packages/guix-extensions.scm

Toggle diff (84 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 238fb72bc5..ba28788776 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -295,6 +295,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/guile.scm \
%D%/packages/guile-wm.scm \
%D%/packages/guile-xyz.scm \
+ %D%/packages/guix-extensions.scm \
%D%/packages/gv.scm \
%D%/packages/gxmessage.scm \
%D%/packages/hardware.scm \
diff --git a/gnu/packages/guix-extensions.scm b/gnu/packages/guix-extensions.scm
new file mode 100644
index 0000000000..bb23b59de4
--- /dev/null
+++ b/gnu/packages/guix-extensions.scm
@@ -0,0 +1,62 @@
+;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages guix-extensions)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (guix build-system trivial)
+ #:use-module (gnu packages version-control))
+
+(define-public guix-send-email
+ (package
+ (name "guix-send-email")
+ (version "0")
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ (list
+ #:modules '((guix build utils))
+ #:builder
+ #~(begin
+ (use-modules (guix build utils))
+ (let ((dest (string-append #$output
+ "/share/guix/extensions/send-email.scm"))
+ (git #$(this-package-input "git"))
+ (git-send-email (assoc-ref %build-inputs "git:send-email")))
+ (mkdir-p (dirname dest))
+ (with-output-to-file dest
+ (lambda ()
+ (format #t
+"(define-module (guix extensions send-email)~@
+ #:use-module (guix scripts)~@
+ #:export (guix-send-email))~@
+~@
+(define-command (guix-send-email . args)~@
+ (category extension)~@
+ (synopsis \"Replace 'guix send-email' with 'git send-email'\")~@
+ (setenv \"GIT_EXEC_PATH\" \"~a/libexec/git-core\")~@
+ (apply system* \"~a/bin/git\" \"send-email\" args))~%"
+ git-send-email git)))))))
+ (home-page "") ; Should be documentation location for GUIX_EXTENSIONS_PATH
+ (inputs
+ `(("git" ,git)
+ ("git:send-email" ,git "send-email")))
+ (synopsis "Replace @code{guix send-email} with @code{git send-email}")
+ (description "This Guix extension provides a shell redirect from @code{guix
+send-email} to @code{git send-email}.")
+ ;; The package definition is longer than the code;
+ ;; let this serve as the declaration of the license.
+ (license license:gpl3+)))

base-commit: 5a9e3b7c3981f684f601e2d21e8202223b384de9
--
2.37.3
L
L
Liliana Marie Prikler wrote on 20 Sep 2022 18:51
31828e626a855e938772534226f7104b921bb6ec.camel@gmail.com
Am Dienstag, dem 20.09.2022 um 13:00 +0300 schrieb Efraim Flashner:
Toggle quote (2 lines)
> * gnu/packages/guix-extensions.scm (guix-send-email): New variable.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add guix-extensions.
Probably unnecessary file; gwl lives nice in package-management.
Toggle quote (101 lines)
> ---
>  gnu/local.mk                     |  1 +
>  gnu/packages/guix-extensions.scm | 62
> ++++++++++++++++++++++++++++++++
>  2 files changed, 63 insertions(+)
>  create mode 100644 gnu/packages/guix-extensions.scm
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 238fb72bc5..ba28788776 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -295,6 +295,7 @@ GNU_SYSTEM_MODULES
> =                                \
>    %D%/packages/guile.scm                       \
>    %D%/packages/guile-wm.scm                    \
>    %D%/packages/guile-xyz.scm                   \
> +  %D%/packages/guix-extensions.scm             \
>    %D%/packages/gv.scm                          \
>    %D%/packages/gxmessage.scm                   \
>    %D%/packages/hardware.scm                    \
> diff --git a/gnu/packages/guix-extensions.scm b/gnu/packages/guix-
> extensions.scm
> new file mode 100644
> index 0000000000..bb23b59de4
> --- /dev/null
> +++ b/gnu/packages/guix-extensions.scm
> @@ -0,0 +1,62 @@
> +;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix.  If not, see
> <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages guix-extensions)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix gexp)
> +  #:use-module (guix packages)
> +  #:use-module (guix build-system trivial)
> +  #:use-module (gnu packages version-control))
> +
> +(define-public guix-send-email
> +  (package
> +    (name "guix-send-email")
> +    (version "0")
> +    (source #f)
> +    (build-system trivial-build-system)
> +    (arguments
> +     (list
> +       #:modules '((guix build utils))
> +       #:builder
> +       #~(begin
> +           (use-modules (guix build utils))
> +           (let ((dest (string-append #$output
> +                                      "/share/guix/extensions/send-
> email.scm"))
> +                 (git            #$(this-package-input "git"))
> +                 (git-send-email (assoc-ref %build-inputs "git:send-
> email")))
> +             (mkdir-p (dirname dest))
> +             (with-output-to-file dest
> +               (lambda ()
> +                 (format #t
> +"(define-module (guix extensions send-email)~@
> +                #:use-module (guix scripts)~@
> +                #:export (guix-send-email))~@
> +~@
> +(define-command (guix-send-email . args)~@
> +                (category extension)~@
> +                (synopsis \"Replace 'guix send-email' with 'git
> send-email'\")~@
> +                (setenv \"GIT_EXEC_PATH\" \"~a/libexec/git-core\")~@
> +                (apply system* \"~a/bin/git\" \"send-email\"
> args))~%"
> +                 git-send-email git)))))))
> +    (home-page "")  ; Should be documentation location for
> GUIX_EXTENSIONS_PATH
> +    (inputs
> +     `(("git" ,git)
> +       ("git:send-email" ,git "send-email")))
> +    (synopsis "Replace @code{guix send-email} with @code{git send-
> email}")
> +    (description "This Guix extension provides a shell redirect from
> @code{guix
> +send-email} to @code{git send-email}.")
> +    ;; The package definition is longer than the code;
> +    ;; let this serve as the declaration of the license.
> +    (license license:gpl3+)))
I don't think this is a useful tool to provide at all nor a useful way
of providing it. For one, I think users of "guix send-email" (which
for the record should probably be guix git send-email analogous to our
other git extensions) would like to have some features from
etc/teams.scm incorporated into them rather than having a wrapper that
simply performs the same operation. For the other, the implementation
takes up more place in Guix than defining the actual command internally
would. Thus, I doubt whether the design choices made here were wise
ones.

Cheers
Z
Z
zimoun wrote on 20 Sep 2022 19:38
Re: [bug#57952] [PATCH] gnu: Add guix-send-email.
(name . Efraim Flashner)(address . efraim@flashner.co.il)
867d1y0ww6.fsf@gmail.com
Hi,

On Tue, 20 Sep 2022 at 13:00, Efraim Flashner <efraim@flashner.co.il> wrote:
Toggle quote (3 lines)
> * gnu/packages/guix-extensions.scm (guix-send-email): New variable.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add guix-extensions.

Oh, that’s cool! If we go for a new file, then maybe the package
guix-modules from gnu/packages/package-management.scm should go there.
WDYT?


Cheers,
simon
E
E
Efraim Flashner wrote on 21 Sep 2022 12:02
Re: [PATCH] gnu: Add guix-send-email.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 57952@debbugs.gnu.org)
YyrhSqTAVJ/QSqXP@3900XT
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMq4UcACgkQQarn3Mo9
g1Ex/BAAtV4eGfgeq0wUZXHpi3RH7TOILyVbyFpZWEPRj14Rg0r8g6DoqbJi9Dg2
2Vlb1LElmCzjS/3MLWETTzTI08C3SDZl7aC5Q+Fiavw9Mx5kx3M6DlROXcgjy4Q2
vDOIeitVFZiwwgBo1ktjp7OztAKPKPcDFhyKWbwItGiknaXTkKa/CDxktvqpnksI
4qv/f+Fey20Vo3jmYOApx5By0xO3L0vBTUsyOkbR0wFt4xRcYD+3Q3bVvUfEJuCn
lvUvx1QjP92sHaQMZG4DqHCP8ZfI5b6IHgH/SU4LlVu+1rwaA/eC6E/P68j/Io3d
0tc2xnw3ZRPkGXeh6BI2wumtbUUwvvr+Iqp1cUgf852ZqjYU1Ep+ZL3iFMGBPjkL
1NHlSvWo5FHaMWY1PlIJ7L6RB+bQxlMzSgOsxNgPcajgdirpJmlZgSuMUQZxuVv5
u3k2reXxoeDszA98r2K/mot1n0rlnfmrXdLdWeWBoz4b04bLNcfJ6kIntnT5jDd2
cbonspJjcdTzUkJUj0MqXniusyHo5bjM3liyCxsDr3mDfkS4RTwu/8oqBhLwITkX
P8Bju1RJ/dwVR9jAz3hIxmgy0M3EGqjZmvb3YxWxVzR0Z6I+cu4o4CCgpgrxWPXy
v3YNGgO+UWmgoY8RY+VaFVby/xDIdVBhFLS+e2xfUE9eiif9ky4=
=zy5w
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 21 Sep 2022 12:03
Re: [bug#57952] [PATCH] gnu: Add guix-send-email.
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 57952@debbugs.gnu.org)
YyrhiUm8f1vmHsCt@3900XT
On Tue, Sep 20, 2022 at 07:38:01PM +0200, zimoun wrote:
Toggle quote (10 lines)
> Hi,
>
> On Tue, 20 Sep 2022 at 13:00, Efraim Flashner <efraim@flashner.co.il> wrote:
> > * gnu/packages/guix-extensions.scm (guix-send-email): New variable.
> > * gnu/local.mk (GNU_SYSTEM_MODULES): Add guix-extensions.
>
> Oh, that’s cool! If we go for a new file, then maybe the package
> guix-modules from gnu/packages/package-management.scm should go there.
> WDYT?

I feel like guix-modules is still about package-management, so it's not
out of place where it is. Some implementation of how-can-i-help would
probably fit better in guix-extensions than elsewhere.

--
Efraim Flashner <efraim@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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMq4YkACgkQQarn3Mo9
g1Gs7Q/8Dn38tetrlIpO4X/V4kNoS3Nxn+3pqtGATC05ABQ2yJRoC7+3Way5SE1L
4oprAwwqVdqBV8YFrVViIAyl6CYrX0oaLnKYx/4ydx5n50LhKWW5DM8YWzr51wBK
B+Pr3xYX8V1Ut71TaCo5DV9UbLCxJFr6rxC1Tq+rN8A9oe7VbTJXWZm/8qWRTXaz
LxFZXpxh9fEHfV2wb1PkEKgOYmhmZlNgbPCNfNN7Pa9vLsFN1FMrsLRyBEZqJxCz
TruwzlJeSp1UqABqpFSMOIAutBJXKnD/ymuOk3wUVWZEE3fI/ODcxG5JFltfYJEZ
VJW/FZ3ofmr9cV+SFChbbDR83FCtq3D/f/7RTQhWDepg1JR4zKl0IfwnpHRx7elV
rblJc3anl88+D7HDQiB5Xv8mQZExfuL3P6eIrZxNuHN07Z9vg0JGXKawPI9GbQxE
FqiVeoXse1S035cI3mg+NXO7CFoxpVWwVTMnQEkpQsHhR7dnkdh2DZUP8LKgyeG2
kUJEjLo2Q8OjLJM3BOXEJRggkeQlkAzF/U0cUg4UhEu0IyeeJiOM3XEBYDxJ5I07
iGD0zSw9xep1B2W1Qs+IkkJc+MEVkq9+jiSMFvkvlANTVLTQLaIo1VotLdqIqJbe
WYkEgPDgXLrYliM78OFnnH09suAA+uRgsvub2anGajNR0JX8akI=
=lOvx
-----END PGP SIGNATURE-----


L
L
Liliana Marie Prikler wrote on 21 Sep 2022 18:56
Re: [PATCH] gnu: Add guix-send-email.
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 57952@debbugs.gnu.org)
f24fa90b88d8c2c72538257a3565949832b2074c.camel@gmail.com
Am Mittwoch, dem 21.09.2022 um 13:02 +0300 schrieb Efraim Flashner:
Toggle quote (14 lines)
> I suppose I didn't explain the package well in the description, but
> the purpose was to (a) create a simple guix extension to serve as an
> example for other people, and (b) to "solve" the case of "oops, I
> wrote guix send-email instead of git send-email".
>
> It's also not an extension that I personally would see myself
> installing.
>
> I would be happy to change it into a cookbook entry, starting with
> (display "Hello World"), moving to (apply system* %hello/bin/hello
> args) and finally guix-send-email to add an example with needing a
> bit more complexity but still understandable. Or guix-vacuum-
> database, to wrap vacuuming /var/guix/db/db.sqlite in a guix
> extension.
In that case I do think it'd be better as a cookbook entry, but I'm
also low-key hoping that if there's serious interest in a guix send-
email, that the etc/teams stuff is merged into that.

Cheers
Z
Z
zimoun wrote on 21 Sep 2022 23:16
Re: [bug#57952] [PATCH] gnu: Add guix-send-email.
(address . 57952@debbugs.gnu.org)
86bkr8zav1.fsf@gmail.com
Hi,

On Wed, 21 Sep 2022 at 13:02, Efraim Flashner <efraim@flashner.co.il> wrote:

Toggle quote (5 lines)
> I suppose I didn't explain the package well in the description, but the
> purpose was to (a) create a simple guix extension to serve as an example
> for other people, and (b) to "solve" the case of "oops, I wrote guix
> send-email instead of git send-email".

The example I prepared for the lightening talk was:

Toggle snippet (10 lines)
(define-module (guix extensiosn hello)
#:export (guix-hello))

(define-command (guix-hello . cmd-line)
(category plumbing)
(synopsis "hello world")

(display (G_ "Hello, world!")))

where the ’plumbing’ category could any other. Even, we could introduce
a special category name ’extension’.

Running another program (as ’hello’ or anything else) could also fit
another good example.


Cheers,
simon
Z
Z
zimoun wrote on 21 Sep 2022 23:19
(address . 57952@debbugs.gnu.org)
867d1wzarc.fsf@gmail.com
Hi,

On Wed, 21 Sep 2022 at 18:56, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

Toggle quote (4 lines)
> In that case I do think it'd be better as a cookbook entry, but I'm
> also low-key hoping that if there's serious interest in a guix send-
> email, that the etc/teams stuff is merged into that.

Maybe etc/teams could end as an extension. People would install the
extension and then run “guix teams”.


Cheers,
simon
M
M
Maxime Devos wrote on 22 Sep 2022 21:30
a29c1bee-3033-31b2-ef9b-86ae8ab9e538@telenet.be
Toggle quote (3 lines)
> + (synopsis "Replace @code{guix send-email} with @code{git send-email}")
> + (description "This Guix extension provides a shell redirect from @code{guix
> +send-email} to @code{git send-email}.")
When I noticed 'gnu: Add guix-send-email', I expected a wrapper around
'git send-email' that provided some additional functionality, more
specifically, I expected you could do something like
$ guix send-email commit1..commit2 --base=commit1
and it would automatically take care of first sending the cover letter,
then waiting for a response, then send the later e-mails to
NNNNN@debbugs.gnu.org.
Without such additional functionality (*), I don't think it's really
useful. However, if it's added to Guix proper (maybe Guix proper could
be tweaked to say 'hint: did you mean git send-email [...]?'), I think
it could be valuable (I would think it's somewhat unlikely for people
that need some help with figuring out that the correct command is "git
send-email" and not "guix send-email", to determine that they need to
install "guix-send-email", so I don't think it solves (b) well).
Toggle quote (2 lines)
> [...] Or guix-vacuum-database, to wrap
> vacuuming /var/guix/db/db.sqlite in a guix extension.
If there is interest in such a command (and not 'merely' as an example
on how to write Guix extensions), I think it would be valuable and
low-cost to have this in Guix proper. (Vacuuming is for reducing disk
usage, if the disk is (close to) full and needs some vacuuming, it might
be too late to install "guix-vacuum-database" ...)
Greetings,
Maxime
(*) integrating etc/teams stuff would be nice too.
Attachment: OpenPGP_signature
L
L
Ludovic Courtès wrote on 28 Sep 2022 22:45
Re: bug#57952: [PATCH] gnu: Add guix-send-email.
(name . Maxime Devos)(address . maximedevos@telenet.be)
871qrvfct5.fsf_-_@gnu.org
Hi!

I must say I’m a bit skeptical about the usefulness of the extension,
though it looks pretty fun :-) and also a good example of how to write
an extension (similar to what Simon presented in Paris).

Maybe we should just keep it as an example in the source tree?

Thanks,
Ludo’.
E
E
Efraim Flashner wrote on 30 Sep 2022 12:39
Close patch
(address . 57952-done@debbugs.gnu.org)
YzbHdqKMrUE9PsZN@3900XT
The consensus is that this would be part of a useful cookbook article,
but there are better options for the namespace of 'guix send-email'

--
Efraim Flashner <efraim@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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmM2x3YACgkQQarn3Mo9
g1Hp/Q/9GzBE8HmF0qTUK35N1uGOiDQTzNrvJH1kJRIDqUphcPMSvIiYg5QNr/WA
mbLBUBf/kdOOLcRt75S3rvs5/a0byQetUaLQbCFSl4eCWZx+R12kZz1QMLYLycns
LcJce8/gWmLraT38bisEU3YwnF7kQrQ11kjt6tfZ86jgFxKmlKhgqjymeSQDnflR
GL/vXuAYf3Mm0Q2QZz+04c65tJNoIoZXKGwmmIjkC1vehv9rrjnso+cwW9ZxcxCa
568vLyRmC3+tPHRgjsnSQ6F6pydZpyK1mY0qfYeYuADuBoYAE4NIIE2MaM2y9wm6
6z4drGONI+Kk9vX+n7KbCbucVxT/eN1JXUdl86qODbvuLfPtoVcDWaT6os8GfydK
5F2TBmjqXOOF7ODMXZuPmwPctkLilHs0nQgag2GAvLgMsZXGOcLcvS2/MCcOvMrE
ddAzlq8ZxyjPWa7LwH3DS73BNZtphCKTBYvwucnbOZm5gmGrWyc3SrkRCOdnQ2nJ
ZHvn9U1U+BP3OSxd/mpvPzTlu/Lmm/f5nMDk9g6WU+gH9XXQ7Ql9cAgNRjD0P50f
/cBcPZ4jk/feG1zrRUqJ51aZybRmocA9Xr3RXh45Oxv0jP4X9B7i/quZ+iK0pnhM
gkCXldc/wx0L7zFizDJvIKTpME90qnrRNKyz16ByvCESyZgrjuo=
=INaz
-----END PGP SIGNATURE-----


Closed
?