2019-10-08 22:46:27 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-04-27 00:21:18 +02:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
sessionVariables = {
|
|
|
|
V1 = "v1";
|
|
|
|
V2 = "v2-${config.programs.zsh.sessionVariables.V1}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-09-26 11:08:45 +02:00
|
|
|
test.stubs.zsh = { };
|
2019-10-08 22:46:27 +02:00
|
|
|
|
2019-04-27 00:21:18 +02:00
|
|
|
nmt.script = ''
|
zsh: move sessionVariables from .zshrc to .zshenv (#2708)
This patch moves both home.sessionVariables and
programs.zsh.sessionVariables from .zshrc to .zshenv. Additionally,
these two kinds of session variables will not be sourced more than
once to allow user-customized ones to take effect.
Before, session variables are in .zshrc, which causes non-interactive
shells to not be able to get those variables. For example, running a
command through SSH is in a non-interactive and non-login shell, which
suffers from this. With this patch, all kinds of shells can get
session variables.
The reason why these session variables are not moved to .zprofile is
that programs started by systemd user instances are not able to get
variables defined in that file. For example, GNOME
Terminal (gnome-terminal-server.service) is one of these programs and
doesn't get variables defined in .zprofile. As a result, the shells it
starts, which are interactive and non-login, do not get those
variables.
Fixes #2445
Related NixOS/nixpkgs#33219
Related NixOS/nixpkgs#45784
This file is not formatted before and is excluded by ./format, so I don't format it.
2022-02-17 10:20:56 +01:00
|
|
|
assertFileExists home-files/.zshenv
|
|
|
|
assertFileRegex home-files/.zshenv 'export V1="v1"'
|
|
|
|
assertFileRegex home-files/.zshenv 'export V2="v2-v1"'
|
2019-04-27 00:21:18 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|