summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-07-01 09:27:24 +0100
committerGitHub <noreply@github.com>2017-07-01 09:27:24 +0100
commit343ad1697d6967b7aa949752fd5c4471f691b4eb (patch)
tree7b61b72686fa7bcb3f5adf53f3cd0098cc12960d /nixos
parentddf864f8aa8b1c41e658a115823d7eaf744f4190 (diff)
parentb73a862f1777ad709b3088255d3967733549fbc9 (diff)
downloadnixlib-343ad1697d6967b7aa949752fd5c4471f691b4eb.tar
nixlib-343ad1697d6967b7aa949752fd5c4471f691b4eb.tar.gz
nixlib-343ad1697d6967b7aa949752fd5c4471f691b4eb.tar.bz2
nixlib-343ad1697d6967b7aa949752fd5c4471f691b4eb.tar.lz
nixlib-343ad1697d6967b7aa949752fd5c4471f691b4eb.tar.xz
nixlib-343ad1697d6967b7aa949752fd5c4471f691b4eb.tar.zst
nixlib-343ad1697d6967b7aa949752fd5c4471f691b4eb.zip
Merge pull request #26897 from layus/nixos-terminfo
terminfo: symlink terminfo to /etc for ncurses
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/system-path.nix1
-rw-r--r--nixos/modules/config/terminfo.nix33
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/environment.nix4
-rw-r--r--nixos/modules/security/sudo.nix4
5 files changed, 34 insertions, 9 deletions
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 59419a5e8c56..9f8d876704c9 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