diff --git a/modules/home-environment.nix b/modules/home-environment.nix index e07343034..68c572066 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -657,7 +657,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} diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index be53a05d2..fed803b06 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -486,7 +486,7 @@ in . "${config.home.sessionVariablesPackage}/etc/profile.d/hm-session-vars.sh" # Only source this once - if [[ -z "$__HM_ZSH_SESS_VARS_SOURCED" ]]; then + if [[ -z "''${__HM_ZSH_SESS_VARS_SOURCED-}" ]]; then export __HM_ZSH_SESS_VARS_SOURCED=1 ${envVarsStr} fi diff --git a/tests/modules/home-environment/session-variables.nix b/tests/modules/home-environment/session-variables.nix index 9e5c7aa7f..9a8baed07 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 IS_EMPTY="" @@ -25,7 +25,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 IS_EMPTY="" diff --git a/tests/modules/programs/zsh/session-variables.zshenv b/tests/modules/programs/zsh/session-variables.zshenv index c132d99d6..cf99c7748 100644 --- a/tests/modules/programs/zsh/session-variables.zshenv +++ b/tests/modules/programs/zsh/session-variables.zshenv @@ -2,7 +2,7 @@ . "/nix/store/00000000000000000000000000000000-hm-session-vars.sh/etc/profile.d/hm-session-vars.sh" # Only source this once -if [[ -z "$__HM_ZSH_SESS_VARS_SOURCED" ]]; then +if [[ -z "${__HM_ZSH_SESS_VARS_SOURCED-}" ]]; then export __HM_ZSH_SESS_VARS_SOURCED=1 export IS_EMPTY="" export IS_FALSE=false