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

i18n: various fixes

This commit is contained in:
midchildan 2020-12-16 22:22:02 +09:00 committed by Robert Helgesson
parent 6f7074d21d
commit e44faef21c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
5 changed files with 54 additions and 50 deletions

View file

@ -1,30 +1,15 @@
{ config, lib, pkgs, ... }:
let inherit (pkgs.stdenv.hostPlatform) isLinux;
in {
{
imports = [
({ ... }: { config.home.sessionPath = [ "foo" ]; })
({ ... }: { config.home.sessionPath = [ "bar" "baz" ]; })
];
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContent \
home-path/etc/profile.d/hm-session-vars.sh \
${
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"
''
}
hmSessVars=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmSessVars
assertFileContains $hmSessVars \
'export PATH="$PATH''${PATH:+:}bar:baz:foo"'
'';
}

View file

@ -1,17 +1,36 @@
{ 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 ''
inherit (pkgs.stdenv.hostPlatform) isDarwin;
linuxExpected = ''
# 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 {
config = {
home.sessionVariables = {
@ -22,7 +41,7 @@ in {
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
${expectedConf}
${expected}
'';
};
}