unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#27791] [PATCH] gnu: Add passmenu
@ 2017-07-22 12:35 Jelle Licht
  2017-07-22 13:00 ` Marius Bakke
  0 siblings, 1 reply; 6+ messages in thread
From: Jelle Licht @ 2017-07-22 12:35 UTC (permalink / raw)
  To: 27791


[-- Attachment #1.1: Type: text/plain, Size: 450 bytes --]

Hello guix,

Attached is a patch to include passmenu, a dmenu interface to the pass
password store.

I was not quite sure how to structure this patch, as it basically installs
and wraps a shell script from the `password-store' sources. We could
instead include it as a separate output of our `password-store' package,
but I already had it like this in my GUIX_PACKAGE_PATH and I was not even
sure if that approach was in general preferable.

- Jelle

[-- Attachment #1.2: Type: text/html, Size: 535 bytes --]

[-- Attachment #2: 0001-gnu-Add-passmenu.patch --]
[-- Type: application/octet-stream, Size: 2618 bytes --]

From 7fec0bd8744d22f55becd36c4635f365de0c676e Mon Sep 17 00:00:00 2001
From: Jelle Licht <jlicht@fsfe.org>
Date: Sat, 22 Jul 2017 14:23:18 +0200
Subject: [PATCH] gnu: Add passmenu.

* gnu/packages/password-utils.scm (passmenu): New variable.
---
 gnu/packages/password-utils.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 08591d108..155e7110a 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -48,6 +48,7 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages suckless)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages version-control)
@@ -446,3 +447,40 @@ use pass, the standard unix password manager, as the credential backend for
 your git repositories.  This is achieved by explicitly defining mappings
 between hosts and entries in the password store.")
     (license license:lgpl3+)))
+
+(define-public passmenu
+  (package
+    (inherit password-store)
+    (name "passmenu")
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin")))
+               (mkdir-p bin)
+               (copy-file "contrib/dmenu/passmenu"
+                          (string-append bin "/passmenu"))
+               #t)))
+         (add-after 'install 'wrap-path
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (path (map (lambda (pkg)
+                                (string-append (assoc-ref inputs pkg) "/bin"))
+                              '("password-store" "dmenu" "xdotool"))))
+               (wrap-program (string-append out "/bin/passmenu")
+                 `("PATH" ":" prefix (,(string-join path ":"))))
+               #t))))
+       #:tests? #f))
+    (inputs
+     `(("password-store" ,password-store)
+       ("xdotool" ,xdotool)
+       ("dmenu" ,dmenu)))
+    (synopsis "Simple dmenu interface to the pass password manager")
+    (description "passmenu allows you to use @code{dmenu} as an interface to
+your @code{pass} password data.  It supports integration with both X11
+clipboard and @code{xdotool}.")))
-- 
2.13.3


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

* [bug#27791] [PATCH] gnu: Add passmenu
  2017-07-22 12:35 [bug#27791] [PATCH] gnu: Add passmenu Jelle Licht
@ 2017-07-22 13:00 ` Marius Bakke
  2017-10-16 13:22   ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Bakke @ 2017-07-22 13:00 UTC (permalink / raw)
  To: Jelle Licht, 27791

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

Hi Jelle,

Jelle Licht <jlicht@fsfe.org> writes:

> Hello guix,
>
> Attached is a patch to include passmenu, a dmenu interface to the pass
> password store.
>
> I was not quite sure how to structure this patch, as it basically installs
> and wraps a shell script from the `password-store' sources. We could
> instead include it as a separate output of our `password-store' package,
> but I already had it like this in my GUIX_PACKAGE_PATH and I was not even
> sure if that approach was in general preferable.

I don't think wrapping it with dmenu in PATH is necessary. Users of this
script are expected to have dmenu from before, and may want to use
another implementation (e.g. rofi), another version, etc.

Can you try to simply add a phase to the normal password-store package
that copies this file to out/bin? We can probably avoid the wrapper too
by giving it the full path to `xdotool`, e.g.:

(substitute "passmenu"
  (("xdotool") (string-append (assoc-ref inputs "xdotool")
                              "/bin/xdotool")))

Adding 'xdotool' adds ~8MiB to the password-store closure size, so I
don't think we need a separate output either.

Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* [bug#27791] [PATCH] gnu: Add passmenu
  2017-07-22 13:00 ` Marius Bakke
@ 2017-10-16 13:22   ` Ludovic Courtès
  2017-10-16 14:05     ` Jelle Licht
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2017-10-16 13:22 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 27791

Hi Jelle,

Is anything holding this back?

  https://bugs.gnu.org/27791

TIA!  :-)

Ludo’.

Marius Bakke <mbakke@fastmail.com> skribis:

> Hi Jelle,
>
> Jelle Licht <jlicht@fsfe.org> writes:
>
>> Hello guix,
>>
>> Attached is a patch to include passmenu, a dmenu interface to the pass
>> password store.
>>
>> I was not quite sure how to structure this patch, as it basically installs
>> and wraps a shell script from the `password-store' sources. We could
>> instead include it as a separate output of our `password-store' package,
>> but I already had it like this in my GUIX_PACKAGE_PATH and I was not even
>> sure if that approach was in general preferable.
>
> I don't think wrapping it with dmenu in PATH is necessary. Users of this
> script are expected to have dmenu from before, and may want to use
> another implementation (e.g. rofi), another version, etc.
>
> Can you try to simply add a phase to the normal password-store package
> that copies this file to out/bin? We can probably avoid the wrapper too
> by giving it the full path to `xdotool`, e.g.:
>
> (substitute "passmenu"
>   (("xdotool") (string-append (assoc-ref inputs "xdotool")
>                               "/bin/xdotool")))
>
> Adding 'xdotool' adds ~8MiB to the password-store closure size, so I
> don't think we need a separate output either.
>
> Thanks!

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

* [bug#27791] [PATCH] gnu: Add passmenu
  2017-10-16 13:22   ` Ludovic Courtès
@ 2017-10-16 14:05     ` Jelle Licht
  2017-10-16 22:09       ` Marius Bakke
  0 siblings, 1 reply; 6+ messages in thread
From: Jelle Licht @ 2017-10-16 14:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27791


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

> Hi Jelle,
>
> Is anything holding this back?
>
>   https://bugs.gnu.org/27791

It just fell through the cracks, thanks for reminding me :-).
I still needed to address some of Marius' concerns though...

>
> TIA!  :-)
>
> Ludo’.
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Hi Jelle,
>>
>> Jelle Licht <jlicht@fsfe.org> writes:
>>
>>> Hello guix,
>>>
>>> Attached is a patch to include passmenu, a dmenu interface to the pass
>>> password store.
>>>
>>> I was not quite sure how to structure this patch, as it basically installs
>>> and wraps a shell script from the `password-store' sources. We could
>>> instead include it as a separate output of our `password-store' package,
>>> but I already had it like this in my GUIX_PACKAGE_PATH and I was not even
>>> sure if that approach was in general preferable.
>>
>> I don't think wrapping it with dmenu in PATH is necessary. Users of this
>> script are expected to have dmenu from before, and may want to use
>> another implementation (e.g. rofi), another version, etc.

While I agree with your general thoughts, wasn't guix supposed to
prevent this ad-hoc mishmash of software? If someone wants to use
another implementation (e.g. rofi), they could just create their own
package that inherits from `password-store' and overrides the "dmenu"
input. Case in point, I am not currently a user of dmenu (besides
indirectly through the passmenu script).

If people still see Marius' proposed solution as preferable, I am also
okay with that.

>>
>> Can you try to simply add a phase to the normal password-store package
>> that copies this file to out/bin? We can probably avoid the wrapper too
>> by giving it the full path to `xdotool`, e.g.:
>>
>> (substitute "passmenu"
>>   (("xdotool") (string-append (assoc-ref inputs "xdotool")
>>                               "/bin/xdotool")))

This seems nicer indeed.
>>
>> Adding 'xdotool' adds ~8MiB to the password-store closure size, so I
>> don't think we need a separate output either.
Fair enough.

>>
>> Thanks!

Thank you for the review.

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

* [bug#27791] [PATCH] gnu: Add passmenu
  2017-10-16 14:05     ` Jelle Licht
@ 2017-10-16 22:09       ` Marius Bakke
  2017-11-10 13:50         ` bug#27791: " Jelle Licht
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Bakke @ 2017-10-16 22:09 UTC (permalink / raw)
  To: Jelle Licht, Ludovic Courtès; +Cc: 27791

[-- Attachment #1: Type: text/plain, Size: 1970 bytes --]

Jelle Licht <jlicht@fsfe.org> writes:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi Jelle,
>>
>> Is anything holding this back?
>>
>>   https://bugs.gnu.org/27791
>
> It just fell through the cracks, thanks for reminding me :-).
> I still needed to address some of Marius' concerns though...
>
>>
>> TIA!  :-)
>>
>> Ludo’.
>>
>> Marius Bakke <mbakke@fastmail.com> skribis:
>>
>>> Hi Jelle,
>>>
>>> Jelle Licht <jlicht@fsfe.org> writes:
>>>
>>>> Hello guix,
>>>>
>>>> Attached is a patch to include passmenu, a dmenu interface to the pass
>>>> password store.
>>>>
>>>> I was not quite sure how to structure this patch, as it basically installs
>>>> and wraps a shell script from the `password-store' sources. We could
>>>> instead include it as a separate output of our `password-store' package,
>>>> but I already had it like this in my GUIX_PACKAGE_PATH and I was not even
>>>> sure if that approach was in general preferable.
>>>
>>> I don't think wrapping it with dmenu in PATH is necessary. Users of this
>>> script are expected to have dmenu from before, and may want to use
>>> another implementation (e.g. rofi), another version, etc.
>
> While I agree with your general thoughts, wasn't guix supposed to
> prevent this ad-hoc mishmash of software? If someone wants to use
> another implementation (e.g. rofi), they could just create their own
> package that inherits from `password-store' and overrides the "dmenu"
> input. Case in point, I am not currently a user of dmenu (besides
> indirectly through the passmenu script).

In the "rofi" case it would be overriding dmenu and providing some extra
command-line arguments, but overall I agree with you and don't really
have a strong opinion.  To my knowledge there is no established policy
for when to allow "impurities" (aka unqualified paths), but optional
dependencies often get a free pass.

I'm happy either way, so do what you think is best :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* bug#27791: [PATCH] gnu: Add passmenu
  2017-10-16 22:09       ` Marius Bakke
@ 2017-11-10 13:50         ` Jelle Licht
  0 siblings, 0 replies; 6+ messages in thread
From: Jelle Licht @ 2017-11-10 13:50 UTC (permalink / raw)
  To: 27791-done


In the end, I simply added dmenu to the list of `inputs' and replaced my
calls to `wrap-program' with a `substitute*' call. Pushed as 177475cfb5
to master.

Someone wanting to make use of an alternative to dmenu could just
inherit from `password-store' in order to override the relevant inputs
and/or phases. The closure size of password-store went from ~421MB to
~440MB, but as it is not a dependency of any non-password-store related
items, this should not be a big problem.

Thanks again for the guidance and reminders.

Marius Bakke <mbakke@fastmail.com> writes:

> Jelle Licht <jlicht@fsfe.org> writes:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Hi Jelle,
>>>
>>> Is anything holding this back?
>>>
>>>   https://bugs.gnu.org/27791
>>
>> It just fell through the cracks, thanks for reminding me :-).
>> I still needed to address some of Marius' concerns though...
>>
>>>
>>> TIA!  :-)
>>>
>>> Ludo’.
>>>
>>> Marius Bakke <mbakke@fastmail.com> skribis:
>>>
>>>> Hi Jelle,
>>>>
>>>> Jelle Licht <jlicht@fsfe.org> writes:
>>>>
>>>>> Hello guix,
>>>>>
>>>>> Attached is a patch to include passmenu, a dmenu interface to the pass
>>>>> password store.
>>>>>
>>>>> I was not quite sure how to structure this patch, as it basically installs
>>>>> and wraps a shell script from the `password-store' sources. We could
>>>>> instead include it as a separate output of our `password-store' package,
>>>>> but I already had it like this in my GUIX_PACKAGE_PATH and I was not even
>>>>> sure if that approach was in general preferable.
>>>>
>>>> I don't think wrapping it with dmenu in PATH is necessary. Users of this
>>>> script are expected to have dmenu from before, and may want to use
>>>> another implementation (e.g. rofi), another version, etc.
>>
>> While I agree with your general thoughts, wasn't guix supposed to
>> prevent this ad-hoc mishmash of software? If someone wants to use
>> another implementation (e.g. rofi), they could just create their own
>> package that inherits from `password-store' and overrides the "dmenu"
>> input. Case in point, I am not currently a user of dmenu (besides
>> indirectly through the passmenu script).
>
> In the "rofi" case it would be overriding dmenu and providing some extra
> command-line arguments, but overall I agree with you and don't really
> have a strong opinion.  To my knowledge there is no established policy
> for when to allow "impurities" (aka unqualified paths), but optional
> dependencies often get a free pass.
>
> I'm happy either way, so do what you think is best :)

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

end of thread, other threads:[~2017-11-10 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-22 12:35 [bug#27791] [PATCH] gnu: Add passmenu Jelle Licht
2017-07-22 13:00 ` Marius Bakke
2017-10-16 13:22   ` Ludovic Courtès
2017-10-16 14:05     ` Jelle Licht
2017-10-16 22:09       ` Marius Bakke
2017-11-10 13:50         ` bug#27791: " Jelle Licht

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