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
17
tests/modules/config/i18n/default.nix
Normal file
17
tests/modules/config/i18n/default.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
i18n = { ... }: {
|
||||
config = {
|
||||
nmt.script = ''
|
||||
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
|
||||
assertFileExists $hmEnvFile
|
||||
assertFileRegex $hmEnvFile \
|
||||
'^export LOCALE_ARCHIVE_._..=".*/lib/locale/locale-archive"$'
|
||||
|
||||
envFile=home-files/.config/environment.d/10-home-manager.conf
|
||||
assertFileExists $envFile
|
||||
assertFileRegex $envFile \
|
||||
'^LOCALE_ARCHIVE_._..=.*/lib/locale/locale-archive$'
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
let inherit (pkgs.stdenv.hostPlatform) isLinux;
|
||||
in {
|
||||
imports = [
|
||||
({ ... }: { config.home.sessionPath = [ "foo" ]; })
|
||||
({ ... }: { config.home.sessionPath = [ "bar" "baz" ]; })
|
||||
|
|
@ -15,7 +16,9 @@
|
|||
# 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"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Only source this once.
|
||||
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
|
||||
export __HM_SESS_VARS_SOURCED=1
|
||||
|
||||
@exportLocaleVar@
|
||||
export V1="v1"
|
||||
export V2="v2-v1"
|
||||
export XDG_CACHE_HOME="/home/hm-user/.cache"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) isLinux;
|
||||
|
||||
expectedConf = pkgs.substituteAll {
|
||||
src = ./session-variables-expected.txt;
|
||||
# the blank space below is intentional
|
||||
exportLocaleVar = optionalString isLinux ''
|
||||
|
||||
export LOCALE_ARCHIVE_2_27="${pkgs.glibcLocales}/lib/locale/locale-archive"'';
|
||||
};
|
||||
in {
|
||||
config = {
|
||||
home.sessionVariables = {
|
||||
V1 = "v1";
|
||||
|
|
@ -11,9 +21,8 @@ with lib;
|
|||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
||||
assertFileContent \
|
||||
home-path/etc/profile.d/hm-session-vars.sh \
|
||||
${./session-variables-expected.txt}
|
||||
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
|
||||
${expectedConf}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
LOCALE_ARCHIVE_2_27=@glibcLocales@/lib/locale/locale-archive
|
||||
V_int=1
|
||||
V_str=2
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@
|
|||
|
||||
with lib;
|
||||
|
||||
{
|
||||
let
|
||||
expectedConf = pkgs.substituteAll {
|
||||
src = ./session-variables-expected.conf;
|
||||
inherit (pkgs) glibcLocales;
|
||||
};
|
||||
in {
|
||||
config = {
|
||||
systemd.user.sessionVariables = {
|
||||
V_int = 1;
|
||||
|
|
@ -12,7 +17,7 @@ with lib;
|
|||
nmt.script = ''
|
||||
envFile=home-files/.config/environment.d/10-home-manager.conf
|
||||
assertFileExists $envFile
|
||||
assertFileContent $envFile ${./session-variables-expected.conf}
|
||||
assertFileContent $envFile ${expectedConf}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ with lib;
|
|||
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 LOCALE_ARCHIVE_2_27="${pkgs.glibcLocales}/lib/locale/locale-archive"'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue