i18n: set the appropriate LOCALE_ARCHIVE_x_xx variable (#1659)
This commit is contained in:
parent
08fc1586c0
commit
9a12cd7e81
12 changed files with 93 additions and 16 deletions
44
modules/config/i18n.nix
Normal file
44
modules/config/i18n.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# The glibc package in nixpkgs is patched to make it possbile to specify
|
||||
# an alternative path for the locale archive through a special environment
|
||||
# variable. This would allow different versions of glibc to coexist on the
|
||||
# same system because each version of glibc could look up different paths
|
||||
# for its locale archive should the archive format ever change in
|
||||
# incompatible ways.
|
||||
#
|
||||
# See also:
|
||||
# localedef(1)
|
||||
# https://nixos.org/manual/nixpkgs/stable/#locales
|
||||
# https://github.com/NixOS/nixpkgs/issues/38991
|
||||
#
|
||||
# XXX: The name of the said environment variable gets updated with each
|
||||
# breaking release of the glibcLocales package. Periodically check the link
|
||||
# below for changes:
|
||||
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch
|
||||
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
inherit (pkgs.glibcLocales) version;
|
||||
|
||||
archivePath = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
|
||||
# lookup the version of glibcLocales and set the appropriate environment vars
|
||||
localeVars = if (versionAtLeast version "2.27") then {
|
||||
LOCALE_ARCHIVE_2_27 = archivePath;
|
||||
} else if (versionAtLeast version "2.11") then {
|
||||
LOCALE_ARCHIVE_2_11 = archivePath;
|
||||
} else
|
||||
{ };
|
||||
in {
|
||||
config = {
|
||||
# for shell sessions
|
||||
home.sessionVariables = localeVars;
|
||||
|
||||
# for desktop apps
|
||||
systemd.user.sessionVariables = localeVars;
|
||||
};
|
||||
|
||||
meta.maintainers = with maintainers; [ midchildan ];
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ let
|
|||
|
||||
allModules = [
|
||||
(loadModule ./accounts/email.nix { })
|
||||
(loadModule ./config/i18n.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./files.nix { })
|
||||
(loadModule ./home-environment.nix { })
|
||||
(loadModule ./manual.nix { })
|
||||
|
|
|
|||
|
|
@ -32,10 +32,7 @@ in {
|
|||
dataDirs = concatStringsSep ":"
|
||||
(map (profile: "${profile}/share") profiles
|
||||
++ config.targets.genericLinux.extraXdgDataDirs);
|
||||
in {
|
||||
XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS";
|
||||
LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
};
|
||||
in { XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"; };
|
||||
|
||||
home.sessionVariablesExtra = ''
|
||||
. "${pkgs.nix}/etc/profile.d/nix.sh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue