`tput` fails for `termite` (its `terminfo` isn't registered?)
tput fails for termite with:
tput: unknown terminal "xterm-termite"
But tput works for other terminals, like the default terminal whose $TERM is xterm-256color. Which makes sense, because it's in /lib/terminfo/, the default $TERMINFO database distributed:
/lib/terminfo/x/xterm-256color
I'm on Ubuntu 16.04 under KDE Plasma 5, and my home.nix includes
bash:
programs.bash.enable = true;
programs.bash.bashrcExtra = ''
tput ...
'';
termite:
programs.termite.enable = true;
'';
- and has
home-managerversion:
programs.home-manager = {
enable = true;
path = https://github.com/rycee/home-manager/archive/release-18.03.tar.gz;
};
I don't know how home-manager works, as after exploring `home-manager-generation:
$ home-manager generations
... -> /nix/store/bm8gyd8lbxyshqdnyv15kbxvyd42v921-home-manager-generation
$ cd /nix/store/bm8gyd8lbxyshqdnyv15kbxvyd42v921-home-manager-generation
$ find -L . -type f | grep -I terminfo
./home-path/share/terminfo/x/xterm-termite
I'm stuck on how to properly "register" this.
Assuming terminfo.enable doesn't register .../share/terminfo/x/xterm-termite on non-NixOS? Or if it does, and the rest of my config intereferes somehow (though tput still fails even with no extra .bashrc).
Finally, I could manually link the share/terminfo from nix:
/home/sboo/.nix-profile/share/terminfo/x/xterm-termite
into the outside-the-home path /lib/terminfo (but only if I've got to).
My current workaround is adding the nix-generated terminfo database to (the otherwise empty) $TERMINFO_DIRS:
from my .bashrc. like so:
programs.bash.bashrcExtra =
''
export TERMINFO_DIRS="$HOME/.nix-profile/share/terminfo":/lib/terminfo
'';
Since I don't know how any of these systems actually interact (or even what level they're on), I don't know if this is the right way to do this, or not.
So, my question is if there's more general solution (like for all standard subdirectories of ~/.nix-profile/share/) that home-manager provides. And if there isn't, can we add this to the wiki (?), or to the https://rycee.gitlab.io/home-manager/options.html (under each support terminal program, like programs.termite)?
Thanks.
Links:
On Wed, 17 Oct 2018 20:10:25 -0700, Spiros Boosalis [email protected] wrote:
tputfails fortermitewith:tput: unknown terminal "xterm-termite"But
tputworks for other terminals, like the default terminal whose$TERMisxterm-256color. Which makes sense, because it's in/lib/terminfo/, the default$TERMINFOdatabase distributed:/lib/terminfo/x/xterm-256color
FWIW this is often built from the terminal db sources along with ncurses-- which only included an entry for termite somewhat recently, I'm not sure if it's in Ubuntu 16.04.
Even so it's under the name 'termite' (as in TERM=termite) which is
apparently correct but not what termite itself will ever set unless you
patch it (there's an upstream PR for this I believe?).
Basically, terminfo can be a smidge of a pain when using termite :).
The two terminfo entries are not the same (!) and I've never compared them in detail-- I'm not sure either is entirely appropriate when using newer VTE. I'd be interested in more information on this if anyone has it, for any vte-based terminals or even differences between them :).
More helpfully perhaps:
-
Does home-manager install
termite.terminfo? If not it should and that's an easy fix I imagine. -
If it does then the question is why isn't it being found, at least by
tputhere. Do other programs successfully work with termite? The environment variableTERMINFO_DIRSshould be set to include your nix profile, I forget what bits are responsible for that but it's easy to check what your $TERMINFO_DIRS ends up as :). -
Different ncurses versions compile terminfo into incompatible formats (and build options make this worse IIRC) where programs using older ncurses can't (necessarily) read terminfo db compiled by newer ncurses. Again, yay things can be a bit painful ;). But basically it might be worth checking where
tputis coming from to ensure it's compatible with whatever terminfo db ends up having the entry for termite.
I'm on Ubuntu 16.04 under KDE Plasma 5, and my
home.nixincludes
bash:programs.bash.enable = true; programs.bash.bashrcExtra = '' tput ... '';
termite:programs.termite.enable = true; '';
- and has
home-managerversion:programs.home-manager = { enable = true; path = https://github.com/rycee/home-manager/archive/release-18.03.tar.gz; };I don't know how
home-managerworks, as after exploring `home-manager-generation:$ home-manager generations ... -> /nix/store/bm8gyd8lbxyshqdnyv15kbxvyd42v921-home-manager-generation $ cd /nix/store/bm8gyd8lbxyshqdnyv15kbxvyd42v921-home-manager-generation $ find -L . -type f | grep -I terminfo ./home-path/share/terminfo/x/xterm-termiteI'm stuck on how to properly "register" this.
Assuming
terminfo.enabledoesn't register.../share/terminfo/x/xterm-termiteon non-NixOS? Or if it does, and the rest of my config intereferes somehow (thoughtputstill fails even with no extra.bashrc).Finally, I could manually link the
share/terminfofromnix:/home/sboo/.nix-profile/share/terminfo/x/xterm-termiteinto the outside-the-home path
/lib/terminfo(but only if I've got to).My current workaround is adding the
nix-generatedterminfodatabase to (the otherwise empty)$TERMINFO_DIRS:from my
.bashrc. like so:programs.bash.bashrcExtra = '' export TERMINFO_DIRS="$HOME/.nix-profile/share/terminfo":/lib/terminfo '';
Welp looks like I info-dumped without finishing reading your report, sorry about thiat. Hope some of it's helpful anyway.
Offhand I think the issue is just that nothing sets TERMINFO_DIRS
when using nix on non-NixOS -- unsure if home-manager should implement
this or if it's something that belongs in
~/.nix-profile/etc/profile.d/nix.sh or whatever.
I'd guess concerns about the sort of compatibility problems I mentioned
above are the reason it's not set, but worth investigating further.
(...brainstorming possible causes...)
Or maybe the problem is that the system default is searched when
TERMINFO_DIRS if unset but isn't used otherwise; this sort of problem
is often handled by allowing a special '::' (empty) entry to indicate
the default path (so you can do
TERMINFO_DIRS=$HOME/.nix-profile/share/terminfo::)... but maybe that's
not supported.
For something like home-manager I'd say if nothing else this makes sense to have as an opt-in (or opt-out, on by default) feature.
Since I don't know how any of these systems actually interact (or even what level they're on), I don't know if this is the right way to do this, or not.
So, my question is if there's more general solution (like for all standard subdirectories of
~/.nix-profile/share/) thathome-managerprovides. And if there isn't, can we add this to the wiki (?), or to the https://rycee.gitlab.io/home-manager/options.html (under each support terminal program, likeprograms.termite)?
:<3:
Thanks.
Links:
Sorry again for re-sharing information you already knew, I've just spent a bunch of time chasing down the same sort of thing and wanted to help :).
"Maybe the hours spent learning these things won't be a waste if it helps someone..."
:innocent: ;)
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rycee/home-manager/issues/423Non-text part: text/html
Thanks for the thorough investigations! I'm on NixOS and do indeed have
$ echo $TERMINFO_DIRS
/home/rycee/.nix-profile/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo:/etc/profiles/per-user/rycee/share/terminfo
because it is set from the NixOS terminfo module. In principle I guess Home Manager could introduce an option that would cause this variable to be set. But in the long term it does seem to me best to fix this in ~/.nix-profile/etc/profile.d/nix.sh since it would improve the situation also for people that do not use Home Manager.
I think I'm running into the same problem with kitty. infocmp has no problem finding the xterm-kitty terminfo though.
Only way I can get my home-manager configuration activated is using env TERM=xterm-256color.
Bump. This makes kitty basically impossible to use with home-manager on non NixOS systems.
For anyone stumbling upon this issue:
This is probably what you are searching for:
export TERMINFO_DIRS=$(nix eval --raw nixpkgs.kitty.terminfo.outPath)/share/terminfo
Or even better you can do the following in your home.nix:
home.sessionVariables = {
TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo";
};
I am also seeing this issue when using kitty, home-manager, and nix-darwin.
I have tried setting TERMINFO_DIRS like @SuperSandro2000 suggested above, but this doesn't seem to have any effect. Here is the relevant line from my home.nix for reference: https://github.com/aergonaut/aether/blob/main/etc/nix/home.nix#L173 If I try echo $TERMINFO_DIRS in my shell, I can see the variable is set to some location in the Nix store. I don't know much about terminfo, however, so I don't know if it is set correctly.
The only thing that has worked for me has been prefixing env TERM=xterm-256color before darwin-rebuild switch, like @toonn suggested.
I was running into the same tput issue and was able to resolve it by adding
environment.variables = {
TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo";
};
to my nix-darwin config. If you are adding it to the zsh portion of your home-manager config, try moving it out of home-manager and into your darwin config to see if that helps.
@ksexton That worked for me! Thanks!
Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting.
If you are the original author of the issue
- If this is resolved, please consider closing it so that the maintainers know not to focus on this.
- If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue
- If you are also experiencing this issue, please add details of your situation to help with the debugging process.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues
If you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information.
Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Would there be a way to resolve this without using home-manager to manage my env variables as suggested?
Setting export TERMINFO_DIRS=$(nix eval --raw nixpkgs.kitty.terminfo.outPath)/share/terminfo doesn't seem to do it on my end.
Ubuntu 20.04
You don't manage all your ENVs with hm but only this one.
My mistake, I didn't know I could do that.
However, it seems that home-manager is still reporting the same issue about kitty terminfo.
home.sessionVariables = {
TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo";
};
home.sessionVariables = { TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo"; };
Thanks for the help, but weirdly even with this config I get the same error.
You need to open a new shell otherwise hm does not reload the ENVs.
You need to open a new shell otherwise hm does not reload the ENVs.
Yep, I understand that. Even after restarting completely, though, it seems the ENV is not loaded as echo $TERMINFO_DIRS is blank.
You need to open a new shell otherwise hm does not reload the ENVs.
Yep, I understand that. Even after restarting completely, though, it seems the ENV is not loaded as
echo $TERMINFO_DIRSis blank.
@jacksonludwig
I think you also need Home Manager to control your shell environment to properly source the environment variables.
One of programs.<bash,zsh,fish>.enable = true.
Hmm, is the suggested fix still valid? I can't reproduce a working state now. 🤔 During darwin-rebuild switch, it fails on the very end...
Activating home-manager configuration for lockejan
tput: unknown terminal "xterm-kitty"
I tried putting the fix in darwin-conf.nix and home.nix, started a new terminal afterwards, without luck.
❯ env | grep kitty TERM=xterm-kitty TERMINFO=/Applications/kitty.app/Contents/Resources/kitty/terminfo TERMINFO_DIRS=/nix/store/vyvynacgm5vbhli833xysvkk0wmzix5j-kitty-0.25.1-terminfo/share/terminfo
Only setting a different TERM on each invocation works for now.😬
I am also running into this with kitty and nix-darwin, even with the TERMINFO_DIRS variable set as described above:
$ darwin-rebuild switch --flake .
...
Activating home-manager configuration for ciaran.downey
tput: unknown terminal "xterm-kitty"
I don't know why it's failing though, because this seems to work fine:
$ tput -T xterm-kitty cols
80
My env from within kitty.app:
$ env | grep TERM
COLORTERM=truecolor
TERMINFO=/nix/store/l9r6mn1hjnhw3i5wfvbs1xl5finb3w7m-kitty-0.25.1/Applications/kitty.app/Contents/Resources/kitty/terminfo
TERM=xterm-kitty
TERMINFO_DIRS=/nix/store/vyvynacgm5vbhli833xysvkk0wmzix5j-kitty-0.25.1-terminfo/share/terminfo
My env from within the default terminal.app:
$ env | grep TERM
TERM_PROGRAM_VERSION=445
TERM_SESSION_ID=F7A77794-5996-4FE0-9B4B-3A5C594A496F
TERM=xterm-256color
TERMINFO_DIRS=/nix/store/vyvynacgm5vbhli833xysvkk0wmzix5j-kitty-0.25.1-terminfo/share/terminfo
TERM_PROGRAM=Apple_Terminal
For completeness, this works fine from within kitty.app too:
$ TERM=xterm-256color darwin-rebuild switch --flake .
...
$ echo $?
0
I think activation scripts don't inherit the user's environment. So setting variables in a given user's environment may not affect them. Maybe activation scripts need to somehow collect all the appropriate terminfo dirs or explicitly inherit them from the invoking user?
Curious to see the solution for this one as well. With the flake based install (home-manager as a module), TERMINFO_DIRS hack doesn't work either in home-manager home.sessionVariables or nix-darwin environment.variables.
@SuperSandro2000 can we reopen this one?
@ciarand Your solution worked for me, i.e.
TERM=xterm-256color nix --extra-experimental-features "nix-command flakes" build .#darwinConfigurations.system
Just wanted to let people know in case they were having trouble activating nix-darwin in kitty
I searched tput throughout the codebase and found three suspicious use:
https://github.com/nix-community/home-manager/blob/db00b39a9abec04245486a01b236b8d9734c9ad0/modules/lib-bash/color-echo.sh#L16
https://github.com/nix-community/home-manager/blob/9bcad2001386a086acda24ae973c230c7b06513f/lib/bash/home-manager.sh#L26
https://github.com/nix-community/home-manager/blob/9bcad2001386a086acda24ae973c230c7b06513f/lib/bash/color-echo#L18
IMO these calls are to detect color support of the terminal. So why not fall back to nocolor when tput fails?
Made a quick implementation of @PhotonQuantum's suggestion. Hopefully it makes things work!
Just to put it on the table, ssh-ing into other machines is still not fixed with this approach. I guess this goes beyond home-manager (nix / terminfo), but fixes like this just help putting it under the rug.
$ echo $TERM
xterm-kitty
$ ssh vpn
Last login: Thu Oct 13 18:36:51 2022 from ...
[root@vpn:~]#
[x@vpn:~]# seq 1 20 | less
WARNING: terminal is not fully functional
Press RETURN to continue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(END)
[x@vpn:~]# logout
Connection to ... closed.
$ TERM=xterm ssh vpn
Last login: Thu Oct 13 18:41:09 2022 from ...
[root@vpn:~]# seq 1 20 | less
[root@vpn:~]#
As you can see, without TERM=xterm things like pager are broken, cursor misbehaves, etc.
@supermarin That doesn't seem related to Home Manager, just a general lack of terminfo? So I think that would be a bug for Nixpkgs.
Gotcha, agreed