2017-06-27 11:57:44 +03:00
|
|
|
# This module manages the terminfo database
|
|
|
|
# and its integration in the system.
|
2021-10-05 14:33:18 +03:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2017-06-27 11:57:44 +03:00
|
|
|
{
|
2021-10-05 14:33:18 +03:00
|
|
|
|
|
|
|
options.environment.enableAllTerminfo = with lib; mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
description = lib.mdDoc ''
|
2021-10-05 14:33:18 +03:00
|
|
|
Whether to install all terminfo outputs
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2017-06-27 11:57:44 +03:00
|
|
|
config = {
|
|
|
|
|
2021-10-05 14:33:18 +03:00
|
|
|
# can be generated with: filter (drv: (builtins.tryEval (drv ? terminfo)).value) (attrValues pkgs)
|
|
|
|
environment.systemPackages = mkIf config.environment.enableAllTerminfo (map (x: x.terminfo) (with pkgs; [
|
|
|
|
alacritty
|
|
|
|
foot
|
|
|
|
kitty
|
|
|
|
mtm
|
|
|
|
rxvt-unicode-unwrapped
|
|
|
|
rxvt-unicode-unwrapped-emoji
|
|
|
|
termite
|
|
|
|
wezterm
|
|
|
|
]));
|
|
|
|
|
2017-06-27 11:57:44 +03:00
|
|
|
environment.pathsToLink = [
|
|
|
|
"/share/terminfo"
|
|
|
|
];
|
|
|
|
|
2019-08-14 00:52:01 +03:00
|
|
|
environment.etc.terminfo = {
|
2017-06-27 11:57:44 +03:00
|
|
|
source = "${config.system.path}/share/terminfo";
|
|
|
|
};
|
|
|
|
|
2019-09-11 13:39:05 +03:00
|
|
|
environment.profileRelativeSessionVariables = {
|
2017-06-27 11:57:44 +03:00
|
|
|
TERMINFO_DIRS = [ "/share/terminfo" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.extraInit = ''
|
|
|
|
|
|
|
|
# reset TERM with new TERMINFO available (if any)
|
|
|
|
export TERM=$TERM
|
|
|
|
'';
|
|
|
|
|
|
|
|
security.sudo.extraConfig = ''
|
|
|
|
|
|
|
|
# Keep terminfo database for root and %wheel.
|
|
|
|
Defaults:root,%wheel env_keep+=TERMINFO_DIRS
|
|
|
|
Defaults:root,%wheel env_keep+=TERMINFO
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|