From e624b9aa6a7caf99eaacfd4ffd9c3ef839c68a66 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 4 Jan 2018 13:15:22 +0100 Subject: home-environment: install `hm-session-vars.sh` file This is a file containing all session variables exported using a Bourne-compatible syntax. --- modules/home-environment.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'modules/home-environment.nix') diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 77850a8e364..66fe430bccd 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -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 ""; -- cgit v1.2.3