1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

i18n: set the appropriate LOCALE_ARCHIVE_x_xx variable (#1659)

This commit is contained in:
midchildan 2021-01-23 23:56:38 +09:00 committed by GitHub
parent 08fc1586c0
commit 9a12cd7e81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 93 additions and 16 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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}
'';
};
}