unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#45190] [PATCH 0/1] Add pinentry-rofi
@ 2020-12-12  2:19 Fredrik Salomonsson
  2020-12-12  2:31 ` [bug#45190] [PATCH 1/1] gnu: " Fredrik Salomonsson
  2021-01-09  1:47 ` [bug#45190] [PATCH v2] gnu: " Fredrik Salomonsson
  0 siblings, 2 replies; 7+ messages in thread
From: Fredrik Salomonsson @ 2020-12-12  2:19 UTC (permalink / raw)
  To: 45190; +Cc: Fredrik Salomonsson

Add pinentry program that is using rofi to input the passphrase.

Fredrik Salomonsson (1):
  gnu: Add pinentry-rofi.

 gnu/packages/gnupg.scm | 81 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

-- 
2.29.2





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#45190] [PATCH 1/1] gnu: Add pinentry-rofi.
  2020-12-12  2:19 [bug#45190] [PATCH 0/1] Add pinentry-rofi Fredrik Salomonsson
@ 2020-12-12  2:31 ` Fredrik Salomonsson
  2021-01-03 21:18   ` Ludovic Courtès
  2021-01-09  1:47 ` [bug#45190] [PATCH v2] gnu: " Fredrik Salomonsson
  1 sibling, 1 reply; 7+ messages in thread
From: Fredrik Salomonsson @ 2020-12-12  2:31 UTC (permalink / raw)
  To: 45190; +Cc: Fredrik Salomonsson

* gnu/packages/gnupg.scm (pinentry-rofi): New variable.
---
 gnu/packages/gnupg.scm | 81 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 3620efea3a..dad6a1de81 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2018, 2019 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Fredrik Salomonsson <plattfot@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -67,6 +68,7 @@
   #:use-module (gnu packages tor)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -892,6 +894,85 @@ passphrase when @code{gpg} is run and needs it.")))
 @dfn{Enlightenment Foundation Libraries} (EFL) that allows users to enter a
 passphrase when @code{gpg} is run and needs it.")))
 
+(define-public pinentry-rofi
+  (package
+  (name "pinentry-rofi")
+  (version "2.0.1")
+  (source (origin
+            (method git-fetch)
+            (uri (git-reference
+                  (url "https://github.com/plattfot/pinentry-rofi/")
+                  (commit version)))
+            (file-name (git-file-name name version))
+            (sha256
+             (base32 "044bnldz7k74s873jwsjgff176l1jsvpbaka7d1wcj8b5pwqv2av"))))
+  (build-system gnu-build-system)
+  (arguments
+    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing
+      #:modules
+      ((ice-9 match)
+       (ice-9 ftw)
+       ,@%gnu-build-system-modules)
+      #:phases
+      (modify-phases
+        %standard-phases
+        (add-after
+          'install
+          'hall-wrap-binaries
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let* ((compiled-dir
+                     (lambda (out version)
+                       (string-append out "/lib/guile/" version "/site-ccache")))
+                   (uncompiled-dir
+                     (lambda (out version)
+                       (string-append
+                         out
+                         "/share/guile/site"
+                         (if (string-null? version) "" "/")
+                         version)))
+                   (dep-path
+                     (lambda (env modules path)
+                       (list env
+                             ":"
+                             'prefix
+                             (cons modules
+                                   (map (lambda (input)
+                                          (string-append
+                                            (assoc-ref inputs input)
+                                            path))
+                                        ,''("rofi"))))))
+                   (out (assoc-ref outputs "out"))
+                   (bin (string-append out "/bin/"))
+                   (site (uncompiled-dir out "")))
+              (match (scandir site)
+                     (("." ".." version)
+                      (for-each
+                        (lambda (file)
+                          (wrap-program
+                            (string-append bin file)
+                            (dep-path
+                              "GUILE_LOAD_PATH"
+                              (uncompiled-dir out version)
+                              (uncompiled-dir "" version))
+                            (dep-path
+                              "GUILE_LOAD_COMPILED_PATH"
+                              (compiled-dir out version)
+                              (compiled-dir "" version))))
+                        ,''("pinentry-rofi"))
+                      #t))))))))
+  (native-inputs
+    `(("autoconf" ,autoconf)
+      ("automake" ,automake)
+      ("pkg-config" ,pkg-config)
+      ("texinfo" ,texinfo)))
+  (inputs `(("guile" ,guile-3.0)))
+  (propagated-inputs `(("rofi" ,rofi)))
+  (synopsis "Rofi GUI for GnuPG's passphrase input")
+  (description "Simple pinentry GUI using rofi that allows users to enter a
+passphrase when required by @code{gpg} or other software.")
+  (home-page "https://github.com/plattfot/pinentry-rofi/")
+  (license license:gpl3+)))
+
 (define-public pinentry
   (package (inherit pinentry-gtk2)
     (name "pinentry")))
-- 
2.29.2





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#45190] [PATCH 1/1] gnu: Add pinentry-rofi.
  2020-12-12  2:31 ` [bug#45190] [PATCH 1/1] gnu: " Fredrik Salomonsson
@ 2021-01-03 21:18   ` Ludovic Courtès
  2021-01-09  2:14     ` Fredrik Salomonsson
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2021-01-03 21:18 UTC (permalink / raw)
  To: Fredrik Salomonsson; +Cc: 45190

Hi Fredrik,

Fredrik Salomonsson <plattfot@posteo.net> skribis:

> * gnu/packages/gnupg.scm (pinentry-rofi): New variable.

Overall LGTM, with some minor issues highlighted below:

> +(define-public pinentry-rofi
> +  (package
> +  (name "pinentry-rofi")

Indentation is off here (should be offset by two).

> +  (arguments
> +    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing

Hmm the ‘strip’ phase should not fail.  Are you sure this is necessary?

> +      #:phases
> +      (modify-phases
> +        %standard-phases
> +        (add-after
> +          'install
> +          'hall-wrap-binaries

Nitpick: please indent as in other files.

> +          (lambda* (#:key inputs outputs #:allow-other-keys)
> +            (let* ((compiled-dir
> +                     (lambda (out version)
> +                       (string-append out "/lib/guile/" version "/site-ccache")))
> +                   (uncompiled-dir
> +                     (lambda (out version)
> +                       (string-append
> +                         out
> +                         "/share/guile/site"
> +                         (if (string-null? version) "" "/")
> +                         version)))
> +                   (dep-path
> +                     (lambda (env modules path)
> +                       (list env
> +                             ":"
> +                             'prefix
> +                             (cons modules
> +                                   (map (lambda (input)
> +                                          (string-append
> +                                            (assoc-ref inputs input)
> +                                            path))
> +                                        ,''("rofi"))))))
> +                   (out (assoc-ref outputs "out"))
> +                   (bin (string-append out "/bin/"))
> +                   (site (uncompiled-dir out "")))
> +              (match (scandir site)
> +                     (("." ".." version)
> +                      (for-each
> +                        (lambda (file)
> +                          (wrap-program
> +                            (string-append bin file)
> +                            (dep-path
> +                              "GUILE_LOAD_PATH"
> +                              (uncompiled-dir out version)
> +                              (uncompiled-dir "" version))
> +                            (dep-path
> +                              "GUILE_LOAD_COMPILED_PATH"
> +                              (compiled-dir out version)
> +                              (compiled-dir "" version))))
> +                        ,''("pinentry-rofi"))
> +                      #t))))))))

Since I think you’re also upstream :-), how about adding something like
that at the top of the installed executable:

  (eval-when (load expand eval)
    (set! %load-path (cons "@moddir@" %load-path))
    (set! %laod-compiled-path (cons "@godir@" %load-compiled-path)))

?

> +  (propagated-inputs `(("rofi" ,rofi)))

It’s best to avoid propagating.  Perhaps you can replace the “rofi”
string in ‘pinentry-rofi’ by “/gnu/store/…/bin/rofi” in a post-install
phase?

> +  (synopsis "Rofi GUI for GnuPG's passphrase input")
> +  (description "Simple pinentry GUI using rofi that allows users to enter a
> +passphrase when required by @code{gpg} or other software.")

Please make it a full sentence.  Also, to give context, perhaps replace
“rofi” by “the Rofi application launcher”.

Could you send an updated patch?

Thanks in advance and sorry for the delay!

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#45190] [PATCH v2] gnu: Add pinentry-rofi.
  2020-12-12  2:19 [bug#45190] [PATCH 0/1] Add pinentry-rofi Fredrik Salomonsson
  2020-12-12  2:31 ` [bug#45190] [PATCH 1/1] gnu: " Fredrik Salomonsson
@ 2021-01-09  1:47 ` Fredrik Salomonsson
  2021-01-13 15:26   ` bug#45190: [PATCH 0/1] " Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Fredrik Salomonsson @ 2021-01-09  1:47 UTC (permalink / raw)
  To: 45190; +Cc: Fredrik Salomonsson

* gnu/packages/gnupg.scm (pinentry-rofi): New variable.
---
 gnu/packages/gnupg.scm | 73 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 3620efea3a..c2ebefc203 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2018, 2019 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Fredrik Salomonsson <plattfot@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -67,6 +68,7 @@
   #:use-module (gnu packages tor)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -892,6 +894,77 @@ passphrase when @code{gpg} is run and needs it.")))
 @dfn{Enlightenment Foundation Libraries} (EFL) that allows users to enter a
 passphrase when @code{gpg} is run and needs it.")))
 
+(define-public pinentry-rofi
+  (package
+    (name "pinentry-rofi")
+    (version "2.0.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/plattfot/pinentry-rofi/")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "044bnldz7k74s873jwsjgff176l1jsvpbaka7d1wcj8b5pwqv2av"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules
+       ((ice-9 match)
+        (ice-9 ftw)
+        ,@%gnu-build-system-modules)
+       #:phases
+       (modify-phases
+           %standard-phases
+         (add-after 'install 'hall-wrap-binaries
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((compiled-dir
+                     (lambda (out version)
+                       (string-append out "/lib/guile/" version "/site-ccache")))
+                    (uncompiled-dir
+                     (lambda (out version)
+                       (string-append
+                        out
+                        "/share/guile/site"
+                        (if (string-null? version) "" "/")
+                        version)))
+                    (dep-path
+                     (lambda (env path)
+                       (list env ":" 'prefix (list path))))
+                    (out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin/"))
+                    (site (uncompiled-dir out "")))
+               (match (scandir site)
+                 (("." ".." version)
+                  (for-each
+                   (lambda (file)
+                     (wrap-program
+                         (string-append bin file)
+                       (dep-path
+                        "PATH"
+                        (string-append (assoc-ref inputs "rofi") "/bin"))
+                       (dep-path
+                        "GUILE_LOAD_PATH"
+                        (uncompiled-dir out version))
+                       (dep-path
+                        "GUILE_LOAD_COMPILED_PATH"
+                        (compiled-dir out version))))
+                   ,''("pinentry-rofi"))
+                  #t))))))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("pkg-config" ,pkg-config)
+       ("texinfo" ,texinfo)))
+    (inputs `(("guile" ,guile-3.0)
+              ("rofi" ,rofi)))
+    (synopsis "Rofi GUI for GnuPG's passphrase input")
+    (description "Pinentry-rofi is a simple graphical user interface for
+passphrase or PIN when required by @code{gpg} or other software.  It is using
+the Rofi application launcher as the user interface.  Which makes it combined
+with @code{rofi-pass} a good front end for @code{password-store}.")
+    (home-page "https://github.com/plattfot/pinentry-rofi/")
+    (license license:gpl3+)))
+
 (define-public pinentry
   (package (inherit pinentry-gtk2)
     (name "pinentry")))
-- 
2.29.2





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#45190] [PATCH 1/1] gnu: Add pinentry-rofi.
  2021-01-03 21:18   ` Ludovic Courtès
@ 2021-01-09  2:14     ` Fredrik Salomonsson
  2021-01-13 15:24       ` [bug#45190] [PATCH 0/1] " Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Fredrik Salomonsson @ 2021-01-09  2:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 45190


Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:

>> +(define-public pinentry-rofi
>> +  (package
>> +  (name "pinentry-rofi")
>
> Indentation is off here (should be offset by two).

Fixed in v2.

>> +  (arguments
>> +    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing
>
> Hmm the ‘strip’ phase should not fail.  Are you sure this is necessary?

It was failing with a warning as there are no binaries to strip. But
it's not an error so I removed this in v2.

>> +      #:phases
>> +      (modify-phases
>> +        %standard-phases
>> +        (add-after
>> +          'install
>> +          'hall-wrap-binaries
>
> Nitpick: please indent as in other files.

Fixed in v2.

> Since I think you’re also upstream :-), how about adding something like
> that at the top of the installed executable:
>
>   (eval-when (load expand eval)
>     (set! %load-path (cons "@moddir@" %load-path))
>     (set! %laod-compiled-path (cons "@godir@" %load-compiled-path)))
>
> ?

Yup, I'm upstream as well. I don't mind adding that, just need to know
what it solves :). I'm guessing that it removes the need to wrap the
executable, is that correct?

And are the "@moddir@" and "@godir@" expected to be expanded by
automake? I tested to just add it in the source code and automake did
nothing with them.

For now I left it out in v2 as I'm a bit unsure of it.

>> +  (propagated-inputs `(("rofi" ,rofi)))

> It’s best to avoid propagating.  Perhaps you can replace the “rofi”
> string in ‘pinentry-rofi’ by “/gnu/store/…/bin/rofi” in a post-install
> phase?

Is there a rule of thumb or something to know when to use propagating
inputs? I'm a bit confused when to use is it. Is it just when dealing
with libraries? What are the downsides of using propagating inputs?
Apologize if this is already mentioned in the manual. Only sections I
could find that mentions propagated inputs are section 5.2 and 8.2.1.

Anyway this is fixed in v2, I added the rofi's binary path to PATH for
the wrapper of pinentry-rofi. 

>> +  (synopsis "Rofi GUI for GnuPG's passphrase input")
>> +  (description "Simple pinentry GUI using rofi that allows users to enter a
>> +passphrase when required by @code{gpg} or other software.")
>
> Please make it a full sentence.  Also, to give context, perhaps replace
> “rofi” by “the Rofi application launcher”.

I fleshed out the description in v2, let me know if it sounds better.

> Could you send an updated patch?

All updates should be in PATCH v2

> Thanks in advance and sorry for the delay!

Thank you for reviewing my patch and no worries about the delay.

-- 
s/Fred[re]+i[ck]+/Fredrik/g




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#45190] [PATCH 0/1] Add pinentry-rofi
  2021-01-09  2:14     ` Fredrik Salomonsson
@ 2021-01-13 15:24       ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2021-01-13 15:24 UTC (permalink / raw)
  To: Fredrik Salomonsson; +Cc: 45190

Hi,

Fredrik Salomonsson <plattfot@posteo.net> skribis:

>>> +  (arguments
>>> +    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing
>>
>> Hmm the ‘strip’ phase should not fail.  Are you sure this is necessary?
>
> It was failing with a warning as there are no binaries to strip. But
> it's not an error so I removed this in v2.

Right, it’s just a warning, due to the fact that .go files are ELF but
the ‘strip’ command doesn’t know what to do with them.

>> Since I think you’re also upstream :-), how about adding something like
>> that at the top of the installed executable:
>>
>>   (eval-when (load expand eval)
>>     (set! %load-path (cons "@moddir@" %load-path))
>>     (set! %laod-compiled-path (cons "@godir@" %load-compiled-path)))
>>
>> ?
>
> Yup, I'm upstream as well. I don't mind adding that, just need to know
> what it solves :). I'm guessing that it removes the need to wrap the
> executable, is that correct?
>
> And are the "@moddir@" and "@godir@" expected to be expanded by
> automake? I tested to just add it in the source code and automake did
> nothing with them.

It’s replaced provided ‘configure.ac’ defines them and AC_SUBSTs them,
along these lines (here they have a longer name):

  https://notabug.org/guile-zstd/guile-zstd/src/master/configure.ac#L43

>> It’s best to avoid propagating.  Perhaps you can replace the “rofi”
>> string in ‘pinentry-rofi’ by “/gnu/store/…/bin/rofi” in a post-install
>> phase?
>
> Is there a rule of thumb or something to know when to use propagating
> inputs? I'm a bit confused when to use is it. Is it just when dealing
> with libraries? What are the downsides of using propagating inputs?
> Apologize if this is already mentioned in the manual. Only sections I
> could find that mentions propagated inputs are section 5.2 and 8.2.1.

In general, propagated inputs should be avoided as they “pollute” the
user’s profile (you install X and find yourself with X, Y, and Z).

The preferred method in situations like this is to patch the source so
it uses absolute file names for commands.

Thanks for sending an updated patch!

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#45190: [PATCH 0/1] Add pinentry-rofi
  2021-01-09  1:47 ` [bug#45190] [PATCH v2] gnu: " Fredrik Salomonsson
@ 2021-01-13 15:26   ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2021-01-13 15:26 UTC (permalink / raw)
  To: Fredrik Salomonsson; +Cc: 45190-done

Fredrik Salomonsson <plattfot@posteo.net> skribis:

> * gnu/packages/gnupg.scm (pinentry-rofi): New variable.

Applied, thanks!

> +               (match (scandir site)
> +                 (("." ".." version)
> +                  (for-each
> +                   (lambda (file)
> +                     (wrap-program
> +                         (string-append bin file)
> +                       (dep-path
> +                        "PATH"
> +                        (string-append (assoc-ref inputs "rofi") "/bin"))
> +                       (dep-path
> +                        "GUILE_LOAD_PATH"
> +                        (uncompiled-dir out version))
> +                       (dep-path
> +                        "GUILE_LOAD_COMPILED_PATH"
> +                        (compiled-dir out version))))
> +                   ,''("pinentry-rofi"))

As I wrote, it’ll be nicer when this is handled upstream, but we can
adjust it on the next release.

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-13 15:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-12  2:19 [bug#45190] [PATCH 0/1] Add pinentry-rofi Fredrik Salomonsson
2020-12-12  2:31 ` [bug#45190] [PATCH 1/1] gnu: " Fredrik Salomonsson
2021-01-03 21:18   ` Ludovic Courtès
2021-01-09  2:14     ` Fredrik Salomonsson
2021-01-13 15:24       ` [bug#45190] [PATCH 0/1] " Ludovic Courtès
2021-01-09  1:47 ` [bug#45190] [PATCH v2] gnu: " Fredrik Salomonsson
2021-01-13 15:26   ` bug#45190: [PATCH 0/1] " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).