mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 17:39:37 +08:00
programs.zsh: option localVariables
Add option "extraLocalVars" for additional local variable definitions
in .zshrc, at the top of the file.
Some zsh plugins/themes expect configuration in local variables before they
are loaded (example: https://github.com/bhilburn/powerlevel9k). Exporting
those clutters the environment and is unnecessary.
(cherry picked from commit 9052131aef)
This commit is contained in:
committed by
Robert Helgesson
parent
257dcbcd8a
commit
2d77421d7c
@@ -12,6 +12,7 @@ let
|
||||
relToDotDir "plugins" else ".zsh/plugins";
|
||||
|
||||
envVarsStr = config.lib.zsh.exportAll cfg.sessionVariables;
|
||||
localVarsStr = config.lib.zsh.defineAll cfg.localVariables;
|
||||
|
||||
aliasesStr = concatStringsSep "\n" (
|
||||
mapAttrsToList (k: v: "alias ${k}='${v}'") cfg.shellAliases
|
||||
@@ -265,6 +266,15 @@ in
|
||||
default = {};
|
||||
description = "Options to configure oh-my-zsh.";
|
||||
};
|
||||
|
||||
localVariables = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=["dir" "vcs"]; };
|
||||
description = ''
|
||||
Extra local variables defined at the top of <filename>.zshrc</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -321,6 +331,8 @@ in
|
||||
${getAttr cfg.defaultKeymap bindkeyCommands}
|
||||
''}
|
||||
|
||||
${localVarsStr}
|
||||
|
||||
${concatStrings (map (plugin: ''
|
||||
path+="$HOME/${pluginsDir}/${plugin.name}"
|
||||
fpath+="$HOME/${pluginsDir}/${plugin.name}"
|
||||
|
||||
Reference in New Issue
Block a user