aboutsummaryrefslogtreecommitdiffstats
path: root/README.org
blob: 0c418196a2293dd90af2427453be40b24bc827d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*- mode: org; coding: utf-8; -*-

#+TITLE: README for Pinentry-Rofi

* Description
  Based on [[https://gist.github.com/sardemff7/759cbf956bea20d382a6128c641d2746][this gist]]

  Simple [[https://www.gnupg.org/related_software/pinentry/index.html][pinentry]] gui using [[https://github.com/davatorium/rofi][rofi]] written in [[https://www.gnu.org/software/guile/][GNU guile]].

  It's similar in functionality as the gist but this one doesn't force
  the width to be 27 and doesn't depend on systemd.

  I also wanted a small project which I could use to practice writing
  GNU guile.

* 2.0.0 Breaking changes please read

  As of version 2.0.0, =pinentry-rofi= is now built using [[https://www.gnu.org/software/automake][automake]].
  See [[file:HACKING][HACKING]] for more info on that. It also lost its =-guile= suffix
  for the executable. And it is no longer just one file, most of its
  content is now a [[https://www.gnu.org/software/guile/manual/html_node/General-Information-about-Modules.html][guile module]], which the executable now calls.

* Install
** Guix (Recommended)
   To install it using [[https://guix.gnu.org/][guix]], run
   #+begin_src shell
     guix install pinentry-rofi
   #+end_src

   Just make sure you have a version of `guix` that is newer than Jan
   8 2021.

   The binary location is then `$HOME/.guix-profile/bin/pinentry-rofi`
   were the `$HOME` is the home location of the user you used to
   install it with. E.g. `/home/$USER` for a normal user and `/root`
   for the root user.

   Install it with guix is recommended as that will work on most linux
   distributions.

   Then add it to your =~/.gnupg/gpg-agent.conf=

*** Guix on a foreign distro

    If you are running guix on a foreign distro, you need to make sure
    the =GUIX_LOCPATH= environment variable is passed to the gpg-agent
    otherwise rofi will fail to set the locale and therefore cannot
    launch. Which result in the pinentry aborting.

    On a distribution that is using systemd (here I'm using Arch Linux
    as an example) simply run:

    #+begin_src shell
      echo "GUIX_LOCPATH=$GUIX_LOCPATH"
    #+end_src

    Copy that, then run:
    #+begin_src shell
      systend --user edit gpg-agent.service
    #+end_src

    And add it in the =override.conf=:
    #+begin_src conf
      [Service]
      Environment=GUIX_LOCPATH=%h/.guix-profile/lib/locale
    #+end_src

    On my system, =GUIX_LOCPATH= points to the default profile i.e.
    =$HOME/.guix-profile/lib/locale=. =%h= in systemd gives you the
    path to the home directory. This should be the case for most
    people, but if your =GUIX_LOCPATH= points to something different
    change the =override.conf= to reflect that.

** Arch Linux
   The =PKGBUILD= file for arch is in the =build-aux=, so just run:

   #+begin_src shell
     cd build-aux
     makepkg -ic
   #+end_src

   The binary location is then `/usr/bin/pinentry-rofi`.

** From Source

  See [[file:HACKING][HACKING]] on how to build this from source

* Gpg-agent

  To use =pinentry-rofi= with =gpg-agent=, you can set it as the
  =pinentry-program= in the =~/.gnupg/gpg-agent.conf=. Note that you
  need to use the full path to the binary.

  For example for Arch Linux this would be:
  #+begin_src conf
    pinentry-program /usr/bin/pinentry-rofi
  #+end_src

  And for guix:
  #+begin_src conf
    pinentry-program <HOME>/.guix-profile/bin/pinentry-rofi
  #+end_src
  Where =<HOME>= is the full path to home for your user.

  Don't forget to restart =gpg-agent= for the changes to take affect:
  #+begin_src shell
    gpg-connect-agent reloadagent /bye
  #+end_src