2021-01-23 14:56:38 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-04-26 22:21:18 +00:00
|
|
|
|
2021-01-23 14:56:38 +00:00
|
|
|
let
|
|
|
|
|
2020-12-16 13:22:02 +00:00
|
|
|
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
|
|
|
|
|
2023-07-04 09:28:25 +00:00
|
|
|
export LOCALE_ARCHIVE_2_27="${config.i18n.glibcLocales}/lib/locale/locale-archive"
|
2020-12-16 13:22:02 +00:00
|
|
|
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"
|
2021-11-04 16:42:44 +00:00
|
|
|
export XDG_STATE_HOME="/home/hm-user/.local/state"
|
2020-12-16 13:22:02 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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"
|
2021-11-04 16:42:44 +00:00
|
|
|
export XDG_STATE_HOME="/home/hm-user/.local/state"
|
2020-12-16 13:22:02 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-27 01:19:28 +00:00
|
|
|
expected = pkgs.writeText "expected"
|
|
|
|
(if isDarwin then darwinExpected else linuxExpected);
|
2021-01-23 14:56:38 +00:00
|
|
|
|
|
|
|
in {
|
2019-04-26 22:21:18 +00:00
|
|
|
config = {
|
|
|
|
home.sessionVariables = {
|
|
|
|
V1 = "v1";
|
|
|
|
V2 = "v2-${config.home.sessionVariables.V1}";
|
|
|
|
};
|
|
|
|
|
|
|
|
nmt.script = ''
|
|
|
|
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
2021-01-23 14:56:38 +00:00
|
|
|
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
|
2020-12-16 13:22:02 +00:00
|
|
|
${expected}
|
2019-04-26 22:21:18 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|