aboutsummaryrefslogtreecommitdiff
path: root/tests/modules/programs/zsh/session-variables.nix
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2019-04-27 00:21:18 +0200
committerRobert Helgesson <robert@rycee.net>2019-04-27 01:07:09 +0200
commitb6e613c7711fcab0adbc582f1db0b83c11840fba (patch)
treecc4599dd96af58bcad68e62104b14bd3b3bbeb0c /tests/modules/programs/zsh/session-variables.nix
parentc5f230e68219252ecda608fcd1f5e85869687d09 (diff)
Fix type of various `sessionVariables` options
Unfortunately, using `attrsOf` is not possible since it results in too eager evaluation. In particular, the home.sessionVariables = { FOO = "Hello"; BAR = "${config.home.sessionVariables.FOO} World!"; }; example will cause an infinite recursion. This commit restores the option type of - `home.sessionVariables`, - `pam.sessionVariables`, - `programs.bash.sessionVariables`, and - `programs.zsh.sessionVariables` to `attrs`. It also adds test cases for the above options to avoid regressions. Fixes #659
Diffstat (limited to 'tests/modules/programs/zsh/session-variables.nix')
-rw-r--r--tests/modules/programs/zsh/session-variables.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/modules/programs/zsh/session-variables.nix b/tests/modules/programs/zsh/session-variables.nix
new file mode 100644
index 00000000000..a87d39820cf
--- /dev/null
+++ b/tests/modules/programs/zsh/session-variables.nix
@@ -0,0 +1,22 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+ config = {
+ programs.zsh = {
+ enable = true;
+
+ sessionVariables = {
+ V1 = "v1";
+ V2 = "v2-${config.programs.zsh.sessionVariables.V1}";
+ };
+ };
+
+ nmt.script = ''
+ assertFileExists home-files/.zshrc
+ assertFileRegex home-files/.zshrc 'export V1="v1"'
+ assertFileRegex home-files/.zshrc 'export V2="v2-v1"'
+ '';
+ };
+}