summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Maudoux <guillaume.maudoux@uclouvain.be>2017-06-27 10:57:44 +0200
committerGuillaume Maudoux <guillaume.maudoux@uclouvain.be>2017-06-30 11:17:11 +0200
commitbd562949cfa82b76ef5959bd53ee9596bc35e705 (patch)
treebcf106a87ca0c64f15fdaf8738707fbb869b7d96
parentd61c22341b00171b53697164cb8241184979d14c (diff)
downloadnixpkgs-bd562949cfa82b76ef5959bd53ee9596bc35e705.tar
nixpkgs-bd562949cfa82b76ef5959bd53ee9596bc35e705.tar.gz
nixpkgs-bd562949cfa82b76ef5959bd53ee9596bc35e705.tar.bz2
nixpkgs-bd562949cfa82b76ef5959bd53ee9596bc35e705.tar.lz
nixpkgs-bd562949cfa82b76ef5959bd53ee9596bc35e705.tar.xz
nixpkgs-bd562949cfa82b76ef5959bd53ee9596bc35e705.tar.zst
nixpkgs-bd562949cfa82b76ef5959bd53ee9596bc35e705.zip
terminfo: symlink terminfo to /etc for ncurses
-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 3ac5f634c7a..cf3cc2f2262 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 00000000000..4fd6ba5ea60
--- /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 07be6555b23..3aa483c848c 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 ba356a8ad2d..401d152941a 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 67a9b9a45ee..cfd0595e63b 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