2020-04-24 23:36:52 +00:00
|
|
|
# This module manages the terminfo database
|
|
|
|
# and its integration in the system.
|
2022-04-15 01:41:22 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
{
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
options.environment.enableAllTerminfo = with lib; mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2022-04-15 01:41:22 +00:00
|
|
|
Whether to install all terminfo outputs
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
config = {
|
|
|
|
|
2022-04-15 01:41:22 +00: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
|
|
|
|
]));
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
environment.pathsToLink = [
|
|
|
|
"/share/terminfo"
|
|
|
|
];
|
|
|
|
|
|
|
|
environment.etc.terminfo = {
|
|
|
|
source = "${config.system.path}/share/terminfo";
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.profileRelativeSessionVariables = {
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|