From bd562949cfa82b76ef5959bd53ee9596bc35e705 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Tue, 27 Jun 2017 10:57:44 +0200 Subject: terminfo: symlink terminfo to /etc for ncurses --- nixos/modules/config/system-path.nix | 1 - nixos/modules/config/terminfo.nix | 33 +++++++++++++++++++++++++++++++++ nixos/modules/module-list.nix | 1 + nixos/modules/programs/environment.nix | 4 ---- nixos/modules/security/sudo.nix | 4 ---- 5 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 nixos/modules/config/terminfo.nix (limited to 'nixos') diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 3ac5f634c7a6..cf3cc2f22628 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -115,7 +115,6 @@ in "/share/mime" "/share/nano" "/share/org" - "/share/terminfo" "/share/themes" "/share/vim-plugins" "/share/vulkan" diff --git a/nixos/modules/config/terminfo.nix b/nixos/modules/config/terminfo.nix new file mode 100644 index 000000000000..4fd6ba5ea605 --- /dev/null +++ b/nixos/modules/config/terminfo.nix @@ -0,0 +1,33 @@ +# This module manages the terminfo database +# and its integration in the system. +{ config, ... }: +{ + config = { + + environment.pathsToLink = [ + "/share/terminfo" + ]; + + environment.etc."terminfo" = { + source = "${config.system.path}/share/terminfo"; + }; + + environment.profileRelativeEnvVars = { + 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 + ''; + + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 07be6555b233..3aa483c848c9 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -21,6 +21,7 @@ ./config/sysctl.nix ./config/system-environment.nix ./config/system-path.nix + ./config/terminfo.nix ./config/timezone.nix ./config/unix-odbc-drivers.nix ./config/users-groups.nix diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix index ba356a8ad2dd..401d152941a0 100644 --- a/nixos/modules/programs/environment.nix +++ b/nixos/modules/programs/environment.nix @@ -34,7 +34,6 @@ in { PATH = [ "/bin" ]; INFOPATH = [ "/info" "/share/info" ]; PKG_CONFIG_PATH = [ "/lib/pkgconfig" ]; - TERMINFO_DIRS = [ "/share/terminfo" ]; PERL5LIB = [ "/lib/perl5/site_perl" ]; KDEDIRS = [ "" ]; STRIGI_PLUGIN_PATH = [ "/lib/strigi/" ]; @@ -50,9 +49,6 @@ in environment.extraInit = '' - # reset TERM with new TERMINFO available (if any) - export TERM=$TERM - unset ASPELL_CONF for i in ${concatStringsSep " " (reverseList cfg.profiles)} ; do if [ -d "$i/lib/aspell" ]; then diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix index 67a9b9a45ee3..cfd0595e63b7 100644 --- a/nixos/modules/security/sudo.nix +++ b/nixos/modules/security/sudo.nix @@ -66,10 +66,6 @@ in # Don't edit this file. Set the NixOS options ‘security.sudo.configFile’ # or ‘security.sudo.extraConfig’ instead. - # Environment variables to keep for root and %wheel. - Defaults:root,%wheel env_keep+=TERMINFO_DIRS - Defaults:root,%wheel env_keep+=TERMINFO - # Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic. Defaults env_keep+=SSH_AUTH_SOCK -- cgit 1.4.1