about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-06-13 18:33:58 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-06-13 18:34:56 +0200
commit13befa3979d6ac98a96880fba9a3239bc333e644 (patch)
tree9745c08a73c25faa114b4f22fbda0c5db68f165e /nixos
parentf5055e2ef6cbb7e836ba80d8458647555aae6793 (diff)
downloadnixlib-13befa3979d6ac98a96880fba9a3239bc333e644.tar
nixlib-13befa3979d6ac98a96880fba9a3239bc333e644.tar.gz
nixlib-13befa3979d6ac98a96880fba9a3239bc333e644.tar.bz2
nixlib-13befa3979d6ac98a96880fba9a3239bc333e644.tar.lz
nixlib-13befa3979d6ac98a96880fba9a3239bc333e644.tar.xz
nixlib-13befa3979d6ac98a96880fba9a3239bc333e644.tar.zst
nixlib-13befa3979d6ac98a96880fba9a3239bc333e644.zip
Set session variables in the shell as well
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/shells-environment.nix6
-rw-r--r--nixos/tests/misc.nix4
2 files changed, 10 insertions, 0 deletions
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index e3ddf9e3c5fa..cc079cdc5856 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -149,6 +149,12 @@ in
 
     system.build.binsh = pkgs.bashInteractive;
 
+    # Set session variables in the shell as well. This is usually
+    # unnecessary, but it allows changes to session variables to take
+    # effect without restarting the session (e.g. by opening a new
+    # terminal instead of logging out of X11).
+    environment.variables = config.environment.sessionVariables;
+
     environment.etc."shells".text =
       ''
         ${concatStringsSep "\n" cfg.shells}
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix
index e33581b4d2d4..8caef146ec87 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -98,6 +98,10 @@ import ./make-test.nix {
           $machine->succeed("touch /tmp2/x");
           $machine->succeed("grep '/tmp2 tmpfs' /proc/mounts");
       };
+
+      subtest "shell-vars", sub {
+          $machine->succeed('[ -n "$NIX_PATH" ]');
+      };
     '';
 
 }