diff mbox series

[bug#53257] gnu: foot: Wrap the program to expose TERMINFO_DIRS

Message ID 20220301192808.14411-1-kevinboulain@gmail.com
State New
Headers show
Series [bug#53257] gnu: foot: Wrap the program to expose TERMINFO_DIRS | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Kevin Boulain March 1, 2022, 7:28 p.m. UTC
As discussed in https://issues.guix.gnu.org/53257, it appears the
preferred way to expose TERMINFO_DIRS to programs running under a
terminal is to wrap the terminal with a script that sets TERMINFO_DIRS
before exec'ing it.
This is less invasive than unconditionally setting TERMINFO_DIRS in the
profile (via native-search-paths) as this particular environment
variable is only necessary when running the terminal itself.

* gnu/packages/terminals.scm (foot): Export TERMINFO_DIRS.
---
 gnu/packages/terminals.scm | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Tom Fitzhenry June 19, 2022, 5:27 a.m. UTC | #1
Tested on my aarch64 machine. foot is now able to open curses
programs without needing to manually set TERM. Thanks!

This patch doesn't cleanly apply against master, but does cleanly apply
against commit deaa322963bc06b820e82d5945e6c496ac6bedf1 "guix: Index the
man-db database via man pages names.", which then cleanly cherry-picks
onto master.
diff mbox series

Patch

diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index 06fa341472..558b91fa24 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -48,6 +48,7 @@ 
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages terminals)
+  #:use-module (guix gexp)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
@@ -63,6 +64,7 @@  (define-module (gnu packages terminals)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
@@ -852,12 +854,24 @@  (define-public foot
        ;; also to address a GCC 10 issue when doing PGO builds.
        #:build-type "release"
        ;; Enable LTO as recommended by INSTALL.md.
-       #:configure-flags '("-Db_lto=true")))
+       #:configure-flags '("-Db_lto=true")
+       ;; Ensure the terminfo database is available to programs spawned under
+       ;; the terminal.
+       #:phases
+       ,#~(modify-phases %standard-phases
+            (add-after 'install 'wrap-program
+              (lambda _
+                (let ((out #$output))
+                  ;; footclient executes programs under the server process,
+                  ;; there is no need to wrap it too.
+                  (wrap-program (string-append out "/bin/foot")
+                    `("TERMINFO_DIRS" ":" prefix
+                      (,(string-append out "/share/terminfo"))))))))))
     (native-inputs
      (list ncurses ;for 'tic'
            pkg-config scdoc wayland-protocols))
     (inputs
-     (list fcft libxkbcommon wayland))
+     (list bash-minimal fcft libxkbcommon wayland))
     (synopsis "Wayland-native terminal emulator")
     (description
      "@command{foot} is a terminal emulator for systems using the Wayland