mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
91d7945974
Many terminal packages don't cross compile, so the `terminfo` NixOS module was not usable for nixos configurations that are cross-compiled. Terminfo files (AFAIK) are small files that contain data about terminal capability, so they should never have any runtime dependencies that would cause any executables or otherwise incompatible outputs from the `buildPlatform` to leak into the nixos config's closure.
77 lines
1.7 KiB
Nix
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.pkgsBuildBuild; [
|
|
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
|
|
'';
|
|
|
|
};
|
|
}
|