Hello y'all

I've come to notice that the terminal emulator I use is not as
compatible with minimal Guix System setups as it could be - `top`
wouldn't start at all and `less` prints the following message:
> WARNING: terminal is not fully functional
but otherwise seems to work just fine.

This of course has to do with (missing) TERMINFO files.  While other
distributions offer to only install these files as separate packages
(i.e. kitty-terminfo in Debian), we currently don't.  I quickly drafted
a patch to output only the terminfo files of my terminal emulator.

--8<---------------cut here---------------start------------->8---

Subject: [PATCH] gnu: kitty: Separate output for TERMINFO file.

* gnu/packages/terminals.scm(kitty): [outputs] New output "terminfo".
[arguments]: New build phase 'move-terminfo-files.

Change-Id: Idfc9e0f72c6f927dfd33321fc3b1d6e91d771590
---
 gnu/packages/terminals.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index 39318110247..48ede868ef8 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -1307,6 +1307,7 @@ (define-public kitty
              (("^SPHINXBUILD[[:space:]]+= (python3.*)$")
               "SPHINXBUILD = sphinx-build\n"))
            #t))))
+    (outputs '("out" "terminfo"))
     (build-system gnu-build-system)
     (native-inputs
      (list dbus
@@ -1370,7 +1371,15 @@ (define-public kitty
                      (oshare (string-append #$output "/share")))
                 (copy-recursively "linux-package/bin" obin)
                 (copy-recursively "linux-package/share" oshare)
-                (copy-recursively "linux-package/lib" olib)))))))
+                (copy-recursively "linux-package/lib" olib))))
+          (add-after 'install 'move-terminfo-files
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((out (assoc-ref outputs "out"))
+                       (terminfo (assoc-ref outputs "terminfo"))
+                       (from (string-append out 
"/lib/kitty/terminfo/x/xterm-kitty"))
+                       (to (string-append terminfo 
"/lib/kitty/terminfo/x/xterm-kitty")))
+                  (mkdir-p (string-append terminfo "/lib/kitty/terminfo/x"))
+                  (rename-file from to)))))))
     (synopsis "Fast, featureful, GPU based terminal emulator")
     (description "Kitty is a fast and featureful GPU-based terminal emulator:
 @itemize

base-commit: d473abf0b40fe4bedf9423a6822d067a9a7826cf
-- 
2.49.0

--8<---------------cut here---------------end--------------->8---

Unfortunately, testing a system container with the bare-bones template
and simply this package output added

--8<---------------cut here---------------start------------->8---
(operating-system
  (packages (cons* (list kitty "terminfo")
                   %base-packages))
--8<---------------cut here---------------end--------------->8---
doesn't do the trick, but settings for example TERMINFO_DIRS works.

Do we have some facility that populates (a common) terminfo profile and
sets one of the TERMINFO* env vars, like it happens with e.g. python
packages and python's load path in Guix?  IIRC with Python a profile
just needs a Python package to unfold the magic - is there something
similar for terminfo files?

I'll happily craft necessary patches to make it all work, but I guess I
could use some pointers in the right directions.

Have a nice day and enjoy your weekends
gabber

Reply via email to