nixpkgs/nixos/modules/config/terminfo.nix
stuebinm 6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00

77 lines
1.7 KiB
Nix

# This module manages the terminfo database
# and its integration in the system.
{ config, lib, pkgs, ... }:
with lib;
{
options = with lib; {
environment.enableAllTerminfo = mkOption {
default = false;
type = types.bool;
description = ''
Whether to install all terminfo outputs
'';
};
security.sudo.keepTerminfo = mkOption {
default = true;
type = types.bool;
description = ''
Whether to preserve the `TERMINFO` and `TERMINFO_DIRS`
environment variables, for `root` and the `wheel` group.
'';
};
};
config = {
# can be generated with:
# attrNames (filterAttrs
# (_: drv: (builtins.tryEval (isDerivation drv && drv ? terminfo)).value)
# pkgs)
environment.systemPackages = mkIf config.environment.enableAllTerminfo (map (x: x.terminfo) (with pkgs; [
alacritty
contour
foot
kitty
mtm
rio
rxvt-unicode-unwrapped
rxvt-unicode-unwrapped-emoji
st
termite
tmux
wezterm
yaft
]));
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 = mkIf config.security.sudo.keepTerminfo ''
# Keep terminfo database for root and %wheel.
Defaults:root,%wheel env_keep+=TERMINFO_DIRS
Defaults:root,%wheel env_keep+=TERMINFO
'';
};
}