···1515 (filterAttrs (k: v: v != null) cfg.shellAliases)
1616 );
17171818+ zshStartupNotes = ''
1919+ # Note that generated /etc/zprofile and /etc/zshrc files do a lot of
2020+ # non-standard setup to make zsh usable with no configuration by default.
2121+ #
2222+ # Which means that unless you explicitly meticulously override everything
2323+ # generated, interactions between your ~/.zshrc and these files are likely
2424+ # to be rather surprising.
2525+ #
2626+ # Note however, that you can disable loading of the generated /etc/zprofile
2727+ # and /etc/zshrc (you can't disable loading of /etc/zshenv, but it is
2828+ # designed to not set anything surprising) by setting `no_global_rcs` option
2929+ # in ~/.zshenv:
3030+ #
3131+ # echo setopt no_global_rcs >> ~/.zshenv
3232+ #
3333+ # See "STARTUP/SHUTDOWN FILES" section of zsh(1) for more info.
3434+ '';
3535+1836in
19372038{
···69877088 promptInit = mkOption {
7189 default = ''
9090+ # Note that to manually override this in ~/.zshrc you should run `prompt off`
9191+ # before setting your PS1 and etc. Otherwise this will likely to interact with
9292+ # your ~/.zshrc configuration in unexpected ways as the default prompt sets
9393+ # a lot of different prompt variables.
7294 autoload -U promptinit && promptinit && prompt walters && setopt prompt_sp
7395 '';
7496 description = ''
···100122 ];
101123 example = [ "EXTENDED_HISTORY" "RM_STAR_WAIT" ];
102124 description = ''
103103- Configure zsh options.
125125+ Configure zsh options. See
126126+ <citerefentry><refentrytitle>zshoptions</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
104127 '';
105128 };
106129···147170 . ${config.system.build.setEnvironment}
148171 fi
149172173173+ HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
174174+175175+ # Tell zsh how to find installed completions.
176176+ for p in ''${(z)NIX_PROFILES}; do
177177+ fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions)
178178+ done
179179+180180+ # Setup custom shell init stuff.
150181 ${cfge.shellInit}
151182152183 ${cfg.shellInit}
···161192 ''
162193 # /etc/zprofile: DO NOT EDIT -- this file has been generated automatically.
163194 # This file is read for login shells.
195195+ #
196196+ ${zshStartupNotes}
164197165198 # Only execute this file once per shell.
166199 if [ -n "$__ETC_ZPROFILE_SOURCED" ]; then return; fi
167200 __ETC_ZPROFILE_SOURCED=1
168201202202+ # Setup custom login shell init stuff.
169203 ${cfge.loginShellInit}
170204171205 ${cfg.loginShellInit}
···180214 ''
181215 # /etc/zshrc: DO NOT EDIT -- this file has been generated automatically.
182216 # This file is read for interactive shells.
217217+ #
218218+ ${zshStartupNotes}
183219184220 # Only execute this file once per shell.
185221 if [ -n "$__ETC_ZSHRC_SOURCED" -o -n "$NOSYSZSHRC" ]; then return; fi
186222 __ETC_ZSHRC_SOURCED=1
187223188188- . /etc/zinputrc
224224+ ${optionalString (cfg.setOptions != []) ''
225225+ # Set zsh options.
226226+ setopt ${concatStringsSep " " cfg.setOptions}
227227+ ''}
189228190190- # Don't export these, otherwise other shells (bash) will try to use same histfile
229229+ # Setup command line history.
230230+ # Don't export these, otherwise other shells (bash) will try to use same HISTFILE.
191231 SAVEHIST=${toString cfg.histSize}
192232 HISTSIZE=${toString cfg.histSize}
193233 HISTFILE=${cfg.histFile}
194234195195- HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
235235+ # Configure sane keyboard defaults.
236236+ . /etc/zinputrc
196237197197- # Tell zsh how to find installed completions
198198- for p in ''${(z)NIX_PROFILES}; do
199199- fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions)
200200- done
201201-202202- ${optionalString cfg.enableGlobalCompInit "autoload -U compinit && compinit"}
238238+ ${optionalString cfg.enableGlobalCompInit ''
239239+ # Enable autocompletion.
240240+ autoload -U compinit && compinit
241241+ ''}
203242243243+ # Setup custom interactive shell init stuff.
204244 ${cfge.interactiveShellInit}
205245206246 ${cfg.interactiveShellInit}
207247208208- ${optionalString (cfg.setOptions != []) "setopt ${concatStringsSep " " cfg.setOptions}"}
209209-248248+ # Setup aliases.
210249 ${zshAliases}
211250251251+ # Setup prompt.
212252 ${cfg.promptInit}
213253214214- # Need to disable features to support TRAMP
254254+ # Disable some features to support TRAMP.
215255 if [ "$TERM" = dumb ]; then
216256 unsetopt zle prompt_cr prompt_subst
217257 unset RPS1 RPROMPT