home-environment: install hm-session-vars.sh file

This is a file containing all session variables exported using a
Bourne-compatible syntax.
This commit is contained in:
Robert Helgesson 2018-01-04 13:15:22 +01:00
parent 2fc1b9b5e0
commit e624b9aa6a
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -267,6 +267,23 @@ in
//
(maybeSet "LC_TIME" cfg.language.time);
home.packages = [
# Provide a file holding all session variables.
(
pkgs.writeTextFile {
name = "hm-session-vars.sh";
destination = "/etc/profile.d/hm-session-vars.sh";
text = ''
# Only source this once.
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
export __HM_SESS_VARS_SOURCED=1
${config.lib.shell.exportAll cfg.sessionVariables}
'';
}
)
];
# A dummy entry acting as a boundary between the activation
# script's "check" and the "write" phases.
home.activation.writeBoundary = dag.entryAnywhere "";