diff --git a/modules/home-environment.nix b/modules/home-environment.nix index a562047b0..514ff13a8 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -633,7 +633,7 @@ in destination = "/etc/profile.d/hm-session-vars.sh"; text = '' # Only source this once. - if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi + if [ -n "''${__HM_SESS_VARS_SOURCED-}" ]; then return; fi export __HM_SESS_VARS_SOURCED=1 ${config.lib.shell.exportAll cfg.sessionVariables} @@ -793,6 +793,7 @@ in export PATH="${activationBinPaths}" ${config.lib.bash.initHomeManagerLib} + source ${config.home.sessionVariablesPackage}/etc/profile.d/hm-session-vars.sh # The driver version indicates the behavior expected by the caller of # this script. diff --git a/tests/modules/home-environment/session-variables-expected.txt b/tests/modules/home-environment/session-variables-expected.txt index a96f61956..cf8581e22 100644 --- a/tests/modules/home-environment/session-variables-expected.txt +++ b/tests/modules/home-environment/session-variables-expected.txt @@ -1,5 +1,5 @@ # Only source this once. -if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi +if [ -n "${__HM_SESS_VARS_SOURCED-}" ]; then return; fi export __HM_SESS_VARS_SOURCED=1 @exportLocaleVar@ export V1="v1" diff --git a/tests/modules/home-environment/session-variables.nix b/tests/modules/home-environment/session-variables.nix index 2cd4d2301..35a3dc5e4 100644 --- a/tests/modules/home-environment/session-variables.nix +++ b/tests/modules/home-environment/session-variables.nix @@ -6,7 +6,7 @@ let linuxExpected = '' # Only source this once. - if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi + if [ -n "''${__HM_SESS_VARS_SOURCED-}" ]; then return; fi export __HM_SESS_VARS_SOURCED=1 export LOCALE_ARCHIVE_2_27="${config.i18n.glibcLocales}/lib/locale/locale-archive" @@ -21,7 +21,7 @@ let darwinExpected = '' # Only source this once. - if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi + if [ -n "''${__HM_SESS_VARS_SOURCED-}" ]; then return; fi export __HM_SESS_VARS_SOURCED=1 export V1="v1"