diff mbox series

[bug#54090,2/2] gnu: Add tessen.

Message ID 20220221183304.5051-2-tanguy@bioneland.org
State Accepted
Headers show
Series None | expand

Commit Message

Tanguy LE CARROUR Feb. 21, 2022, 6:33 p.m. UTC
* gnu/packages/password-utils.scm (tessen): New variable.
---
 gnu/packages/password-utils.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Ludovic Courtès March 3, 2022, 10:30 p.m. UTC | #1
Tanguy Le Carrour <tanguy@bioneland.org> skribis:

> * gnu/packages/password-utils.scm (tessen): New variable.

[...]

> +     (origin
> +       (method url-fetch)
> +       (uri
> +        (string-append "https://raw.githubusercontent.com/ayushnix/tessen/"
> +                       "v" version "/tessen"))

Is this a stable URL?

> +       #:builder
> +       (begin
> +         (use-modules (guix build utils))
> +         (let ((source (string-append (assoc-ref %build-inputs "source")))
> +               (script "tessen")
> +               (out (assoc-ref %outputs "out")))

Could you change that to use a gexp, along these lines:

  #:builder #~(begin
                …
                (let ((source #$(package-source this-package))
                      (out    #$output)
                      …)
                  …))

> +    (propagated-inputs
> +     (list wtype))

Could you substitute* the absolute file name of ‘wtype’ in the script
instead of propagating?

TIA!

Ludo’.
Tanguy LE CARROUR March 6, 2022, 6:40 p.m. UTC | #2
Hi Ludo’

Thanks for reviewing!


Quoting Ludovic Courtès (2022-03-03 23:30:23)
> Tanguy Le Carrour <tanguy@bioneland.org> skribis:
> 
> > * gnu/packages/password-utils.scm (tessen): New variable.
> 
> [...]
> 
> > +     (origin
> > +       (method url-fetch)
> > +       (uri
> > +        (string-append "https://raw.githubusercontent.com/ayushnix/tessen/"
> > +                       "v" version "/tessen"))
> 
> Is this a stable URL?

As stable as it can get, nowadays?! ^_^'
Anyway, might not be a problem any more once you've reached the end of
this email…


> > +       #:builder
> > +       (begin
> > +         (use-modules (guix build utils))
> > +         (let ((source (string-append (assoc-ref %build-inputs "source")))
> > +               (script "tessen")
> > +               (out (assoc-ref %outputs "out")))
> 
> Could you change that to use a gexp, along these lines:
> 
>   #:builder #~(begin
>                 …
>                 (let ((source #$(package-source this-package))
>                       (out    #$output)
>                       …)
>                   …))

Mmmm… I tried, but could not get anything to work! I ended up with:

```
#:builder #~(begin
             (use-modules (guix build utils))
             (let ((source #$(package-source this-package))
                   (out    #$output)
                   (wtype  #$(this-package-input "wtype"))
                   (script "tessen"))
               (copy-file source script)
               (chmod script #o555)
               (substitute* script
                 (("wtype") (string-append wtype "/bin/wtype")))
               (install-file script (string-append out "/bin"))))
```

But it failed with:

```
ERROR: In procedure %resolve-variable:
Unbound variable: gexp
```


> > +    (propagated-inputs
> > +     (list wtype))
> 
> Could you substitute* the absolute file name of ‘wtype’ in the script
> instead of propagating?

This, at least, I think I did properly! Without the Gexp, I wrote
something that works:

```
(begin
 (use-modules (guix build utils))
 (let ((source (string-append (assoc-ref %build-inputs "source")))
       (script "tessen")
       (out (assoc-ref %outputs "out")))
       (out    (assoc-ref %outputs "out"))
       (wtype  (assoc-ref %build-inputs "wtype"))
       (script "tessen"))
   (copy-file source script)
   (chmod script #o555)
   (install-file script (string-append out "/bin"))))))
```

But actually, I figured out that Tessen was not "just" a Bash script and
could be "properly" `make install`-ed. So, I'll try to rewrite a proper
package definition, fetching the source from Git and installing it the
good old way! I can then use a more familiar `modify-phases` to
substitute `wtype` in the script.

Sounds like a plan to you?!

Regards,
M March 6, 2022, 7:33 p.m. UTC | #3
Tanguy LE CARROUR schreef op zo 06-03-2022 om 19:40 [+0100]:
> ```
> ERROR: In procedure %resolve-variable:
> Unbound variable: gexp

Replace the quasiquote (`) by 'list' and import (guix gexp):

(package
  ...
  (arguments
    (list #:builder
          #~(foo bar ...))))
diff mbox series

Patch

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 440bb927a6..ad21bd3ae8 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -736,6 +736,39 @@  (define-public rofi-pass
 @end enumerate")
     (license license:gpl3)))
 
+(define-public tessen
+  (package
+    (name "tessen")
+    (version "2.0.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://raw.githubusercontent.com/ayushnix/tessen/"
+                       "v" version "/tessen"))
+       (sha256
+        (base32 "1n2q0w31ylnrsvrnv6fz4zc6wxbxrjqx8q4j1fdgamq5b4d9wjcn"))
+       (file-name name)))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((source (string-append (assoc-ref %build-inputs "source")))
+               (script "tessen")
+               (out (assoc-ref %outputs "out")))
+           (copy-file source script)
+           (chmod script #o555)
+           (install-file script (string-append out "/bin"))))))
+    (propagated-inputs
+     (list wtype))
+    (home-page "https://github.com/ayushnix/tessen")
+    (synopsis "Frontend for password-store and gopass")
+    (description "Tessen is a bash script that can autotype and copy data
+from password-store and gopass files.")
+    (license license:gpl2+)))
+
 (define-public browserpass-native
   (package
     (name "browserpass-native")