targets/genericLinux: set TERMINFO_DIRS (#1819)

This makes terminfo descriptions in installed packages available to
shell sessions. Not needed for NixOS, which does the same thing already.
wip/yesman
midchildan 3 years ago committed by GitHub
parent abc9d96d19
commit 5fbb33cff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      modules/targets/generic-linux.nix
  2. 8
      tests/modules/targets-linux/generic-linux.nix

@ -32,10 +32,27 @@ in {
dataDirs = concatStringsSep ":"
(map (profile: "${profile}/share") profiles
++ config.targets.genericLinux.extraXdgDataDirs);
in { XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"; };
# https://github.com/archlinux/svntogit-packages/blob/packages/ncurses/trunk/PKGBUILD
# https://salsa.debian.org/debian/ncurses/-/blob/master/debian/rules
# https://src.fedoraproject.org/rpms/ncurses/blob/main/f/ncurses.spec
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/ncurses/ncurses-6.2-r1.ebuild
distroTerminfoDirs = concatStringsSep ":" [
"/etc/terminfo" # debian, fedora, gentoo
"/lib/terminfo" # debian
"/usr/share/terminfo" # package default, all distros
];
in {
XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS";
TERMINFO_DIRS =
"${profileDirectory}/share/terminfo:$TERMINFO_DIRS\${TERMINFO_DIRS:+:}${distroTerminfoDirs}";
};
home.sessionVariablesExtra = ''
. "${pkgs.nix}/etc/profile.d/nix.sh"
# reset TERM with new TERMINFO available (if any)
export TERM="$TERM"
'';
# We need to source both nix.sh and hm-session-vars.sh as noted in

@ -11,12 +11,20 @@ with lib;
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'export XDG_DATA_DIRS="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share:/home/hm-user/.nix-profile/share:/foo''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"'
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'. "${pkgs.nix}/etc/profile.d/nix.sh"'
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'export TERMINFO_DIRS="/home/hm-user/.nix-profile/share/terminfo:$TERMINFO_DIRS''${TERMINFO_DIRS:+:}/etc/terminfo:/lib/terminfo:/usr/share/terminfo"'
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'export TERM="$TERM"'
'';
};
}

Loading…
Cancel
Save