i18n: various fixes
This commit is contained in:
parent
6f7074d21d
commit
e44faef21c
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -12,6 +12,7 @@
|
||||||
/modules/misc/gtk.nix @rycee
|
/modules/misc/gtk.nix @rycee
|
||||||
|
|
||||||
/modules/config/i18n.nix @midchildan
|
/modules/config/i18n.nix @midchildan
|
||||||
|
/tests/modules/config/i18n @midchildan
|
||||||
|
|
||||||
/modules/misc/news.nix @rycee
|
/modules/misc/news.nix @rycee
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# The glibc package in nixpkgs is patched to make it possbile to specify
|
# The glibc package in Nixpkgs is patched to make it possible to specify
|
||||||
# an alternative path for the locale archive through a special environment
|
# an alternative path for the locale archive through a special environment
|
||||||
# variable. This would allow different versions of glibc to coexist on the
|
# variable. This would allow different versions of glibc to coexist on the
|
||||||
# same system because each version of glibc could look up different paths
|
# same system because each version of glibc could look up different paths
|
||||||
|
@ -6,11 +6,11 @@
|
||||||
# incompatible ways.
|
# incompatible ways.
|
||||||
#
|
#
|
||||||
# See also:
|
# See also:
|
||||||
# localedef(1)
|
# - localedef(1)
|
||||||
# https://nixos.org/manual/nixpkgs/stable/#locales
|
# - https://nixos.org/manual/nixpkgs/stable/#locales
|
||||||
# https://github.com/NixOS/nixpkgs/issues/38991
|
# - https://github.com/NixOS/nixpkgs/issues/38991
|
||||||
#
|
#
|
||||||
# XXX: The name of the said environment variable gets updated with each
|
# Note, the name of the said environment variable gets updated with each
|
||||||
# breaking release of the glibcLocales package. Periodically check the link
|
# breaking release of the glibcLocales package. Periodically check the link
|
||||||
# below for changes:
|
# below for changes:
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch
|
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch
|
||||||
|
@ -20,25 +20,27 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (pkgs.glibcLocales) version;
|
inherit (pkgs.glibcLocales) version;
|
||||||
|
|
||||||
archivePath = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
archivePath = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||||
|
|
||||||
# lookup the version of glibcLocales and set the appropriate environment vars
|
# lookup the version of glibcLocales and set the appropriate environment vars
|
||||||
localeVars = if (versionAtLeast version "2.27") then {
|
localeVars = if versionAtLeast version "2.27" then {
|
||||||
LOCALE_ARCHIVE_2_27 = archivePath;
|
LOCALE_ARCHIVE_2_27 = archivePath;
|
||||||
} else if (versionAtLeast version "2.11") then {
|
} else if versionAtLeast version "2.11" then {
|
||||||
LOCALE_ARCHIVE_2_11 = archivePath;
|
LOCALE_ARCHIVE_2_11 = archivePath;
|
||||||
} else
|
} else
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
meta.maintainers = with maintainers; [ midchildan ];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
# for shell sessions
|
# For shell sessions.
|
||||||
home.sessionVariables = localeVars;
|
home.sessionVariables = localeVars;
|
||||||
|
|
||||||
# for desktop apps
|
# For desktop apps.
|
||||||
systemd.user.sessionVariables = localeVars;
|
systemd.user.sessionVariables = localeVars;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = with maintainers; [ midchildan ];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,15 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let inherit (pkgs.stdenv.hostPlatform) isLinux;
|
{
|
||||||
in {
|
|
||||||
imports = [
|
imports = [
|
||||||
({ ... }: { config.home.sessionPath = [ "foo" ]; })
|
({ ... }: { config.home.sessionPath = [ "foo" ]; })
|
||||||
({ ... }: { config.home.sessionPath = [ "bar" "baz" ]; })
|
({ ... }: { config.home.sessionPath = [ "bar" "baz" ]; })
|
||||||
];
|
];
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
hmSessVars=home-path/etc/profile.d/hm-session-vars.sh
|
||||||
assertFileContent \
|
assertFileExists $hmSessVars
|
||||||
home-path/etc/profile.d/hm-session-vars.sh \
|
assertFileContains $hmSessVars \
|
||||||
${
|
'export PATH="$PATH''${PATH:+:}bar:baz:foo"'
|
||||||
pkgs.writeText "session-path-expected.txt" ''
|
|
||||||
# Only source this once.
|
|
||||||
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
|
|
||||||
export __HM_SESS_VARS_SOURCED=1
|
|
||||||
${lib.optionalString isLinux ''
|
|
||||||
|
|
||||||
export LOCALE_ARCHIVE_2_27="${pkgs.glibcLocales}/lib/locale/locale-archive"''}
|
|
||||||
export XDG_CACHE_HOME="/home/hm-user/.cache"
|
|
||||||
export XDG_CONFIG_HOME="/home/hm-user/.config"
|
|
||||||
export XDG_DATA_HOME="/home/hm-user/.local/share"
|
|
||||||
export PATH="$PATH''${PATH:+:}bar:baz:foo"
|
|
||||||
''
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,36 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs.stdenv.hostPlatform) isLinux;
|
|
||||||
|
|
||||||
expectedConf = pkgs.substituteAll {
|
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||||
src = ./session-variables-expected.txt;
|
|
||||||
# the blank space below is intentional
|
linuxExpected = ''
|
||||||
exportLocaleVar = optionalString isLinux ''
|
# Only source this once.
|
||||||
|
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
|
||||||
|
export __HM_SESS_VARS_SOURCED=1
|
||||||
|
|
||||||
|
export LOCALE_ARCHIVE_2_27="${pkgs.glibcLocales}/lib/locale/locale-archive"
|
||||||
|
export V1="v1"
|
||||||
|
export V2="v2-v1"
|
||||||
|
export XDG_CACHE_HOME="/home/hm-user/.cache"
|
||||||
|
export XDG_CONFIG_HOME="/home/hm-user/.config"
|
||||||
|
export XDG_DATA_HOME="/home/hm-user/.local/share"
|
||||||
|
'';
|
||||||
|
|
||||||
|
darwinExpected = ''
|
||||||
|
# Only source this once.
|
||||||
|
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
|
||||||
|
export __HM_SESS_VARS_SOURCED=1
|
||||||
|
|
||||||
|
export V1="v1"
|
||||||
|
export V2="v2-v1"
|
||||||
|
export XDG_CACHE_HOME="/home/hm-user/.cache"
|
||||||
|
export XDG_CONFIG_HOME="/home/hm-user/.config"
|
||||||
|
export XDG_DATA_HOME="/home/hm-user/.local/share"
|
||||||
|
'';
|
||||||
|
|
||||||
|
expected = pkgs.writeText "expected" (if isDarwin then darwinExpected else linuxExpected);
|
||||||
|
|
||||||
export LOCALE_ARCHIVE_2_27="${pkgs.glibcLocales}/lib/locale/locale-archive"'';
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
config = {
|
config = {
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
|
@ -22,7 +41,7 @@ in {
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
||||||
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
|
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
${expectedConf}
|
${expected}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
{
|
||||||
|
|
||||||
let
|
|
||||||
expectedConf = pkgs.substituteAll {
|
|
||||||
src = ./session-variables-expected.conf;
|
|
||||||
inherit (pkgs) glibcLocales;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
config = {
|
config = {
|
||||||
systemd.user.sessionVariables = {
|
systemd.user.sessionVariables = {
|
||||||
V_int = 1;
|
V_int = 1;
|
||||||
|
@ -17,7 +10,11 @@ in {
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
envFile=home-files/.config/environment.d/10-home-manager.conf
|
envFile=home-files/.config/environment.d/10-home-manager.conf
|
||||||
assertFileExists $envFile
|
assertFileExists $envFile
|
||||||
assertFileContent $envFile ${expectedConf}
|
assertFileContent $envFile ${pkgs.writeText "expected" ''
|
||||||
|
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive
|
||||||
|
V_int=1
|
||||||
|
V_str=2
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue