Commit Graph

66 Commits

Author SHA1 Message Date
pennae
2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
pennae
e24a8775a8 treewide: set defaultText for options using simple path defaults
adds defaultText for all options that set their default to a path expression
using the ubiquitous `cfg` shortcut bindings.
2021-12-09 01:12:13 +01:00
Andreas Fuchs
8a37d710fd nixos: zsh: Remove hack for zsh-nix-completions on nix 2.4
The zsh-nix-completions package now sets a priority, which helps avoid
conflicts with newer nix versions without patching the package from
the module.
2021-11-14 22:09:01 +01:00
Jörg Thalheim
8c5c0d6748 nixos: fix zinputrc on flake-enabled systems 2021-08-05 22:19:37 +02:00
Maximilian Bosch
15dab3835f
Merge pull request #128649 from nrdxp/fix-unstable-nix-zsh-completions
zsh: fix nixUnstable completions
2021-07-22 14:58:20 +02:00
Timothy DeHerrera
6dbf8c0409
zsh: include completions for nix-* commands 2021-07-21 15:55:25 -06:00
Timothy DeHerrera
9ad645dce8
zsh: format module with nixpkgs-fmt 2021-07-21 15:55:25 -06:00
Timothy DeHerrera
d687fe88fd
zsh: remove conflicting nixUnstable completions 2021-07-21 15:55:22 -06:00
*Kim Zick
fbbaa4d40f
nixos/zsh: change default prompt theme to 'suse'
This resolves a long-standing issue caused by the 'walters' theme setting `RPS1`.  See #38535 for discussion details.
2021-06-26 06:36:51 -04:00
Benjamin Asbach
cbb5b578b8 zsh: added option to enable compatibility with bash's completion system 2020-05-03 12:08:25 +02:00
Jörg Thalheim
55819e6c86
Revert "zsh: don't clobber the environment of non-login shells"
This reverts commit 6a756af3e7.

Currently zshenv by default only set fpath and HELPDIR without exporting them.
A parent shell would also not set those variables usually as they are shell local.

It also sources a file called set-environment but this is protected by an
environment variable called __NIXOS_SET_ENVIRONMENT_DONE. Hence any modification
done by the parent shell should persist as long as __NIXOS_SET_ENVIRONMENT_DONE
is not unset.

This behavior deviates from what we do in bashrc and breaks common setups such
as tmux/mosh or screen.

Fixes #80437
2020-02-18 15:52:21 +00:00
Michael Raskin
f320a0231c
Merge pull request #67376 from oxij/nixos/zsh-doc
nixos: zsh: add more helpful documentation into generated files
2020-02-09 11:58:30 +00:00
Frederik Rietdijk
ad1d58c622 Merge staging-next into staging 2019-08-31 10:04:20 +02:00
Frederik Rietdijk
5061fe0c2c Merge staging-next into staging 2019-08-28 08:26:42 +02:00
Matthew Bauer
4081bec5ac
zsh: remove unfunction on TERM=dumb
Unfortunately this gives an error when precmd or preexec exists. Removing to avoid that.
2019-08-27 11:00:58 -04:00
volth
35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
Jan Malakhovski
2eaf57541f nixos: zsh: reorder /etc/zshrc a little bit, add more helpful documentation 2019-08-24 05:48:57 +00:00
Jan Malakhovski
f70e3f3738 nixos: zsh: move NixOS-specific variables from /etc/zshrc to /etc/zshenv
We want these to be set even when /etc/zshrc loading is disabled.
2019-08-24 05:36:02 +00:00
Matthew Bauer
ac773d1607 nixos/zsh: Fix tramp support
For a long time, TRAMP has not worked with ZSH NixOS servers. I
thought I fixed this in 0740f57e63af61694d14796286cb9204, but now
realize that was only half the problem. For TRAMP to start working
again ‘unsetopt zle’ was needed, otherwise the connection would hang.
In addition, I have a few more settings added that can apparenty
interfere with these settings.
2019-08-21 21:24:45 -04:00
Jan Malakhovski
065c6ed96e nixos: zsh: setopt prompt_sp to workaround a zsh bug
See #38535, properly fixing the prompt seems complicated, and this seems
to work in all the ttys I checked.

Suggested by @Mic92.
2019-08-19 22:58:13 +00:00
Izorkin
82ad143a51
nixos/zsh: move zsh setopt 2019-06-09 00:13:01 +02:00
Daniel Schaefer
786f02f7a4 treewide: Remove usage of isNull
isNull "is deprecated; just write e == null instead" says the Nix manual
2019-04-29 14:05:50 +02:00
Florian Klink
2457510db4
Merge pull request #51918 from bobvanderlinden/var-run
tree-wide: nixos: /var/run -> /run
2019-04-07 20:09:46 +02:00
Will Dietz
173f79f690 zsh: don't export HISTFILE and friends
Just set them normally.
Exporting them will propagate them to all executed programs
such as bash (as used by nix-shell or nix run),
and badness ensues when different formats are used.
2019-03-21 10:28:20 -05:00
Bob van der Linden
9d4bc79003 nixos/zsh: do not use /var/run 2019-03-20 00:01:45 +01:00
Izorkin
53d05fd0cc nixos/zsh: enable configure history and custom options 2019-03-18 19:57:54 +03:00
Mitsuhiro Nakamura
c941577dcb nixos/shells: enable to nullify already defined aliases 2018-10-14 00:14:49 +09:00
Mitsuhiro Nakamura
3b5449b80c nixos/shells: programs.*sh.shellAliases override environment.shellAliases 2018-10-14 00:14:09 +09:00
Maximilian Bosch
1e211a70cb nixos/zsh: use `escapeShelLArg' for shell aliases (#47471)
Previously single quotes were used by default for aliases and the module
never warned about possible collisions when having a shell alias which
relies on single quotes.

Adding `escapeShellArg` works around this fixes the issue and ensures that a
properly quoted value is written to `/etc/zshrc`.
2018-09-28 23:42:55 +02:00
xeji
5fc8ebdda0
Merge pull request #45784 from oxij/pull/44720-shell-env-edited
nixos/shells: Avoid overriding the environment for other child shells
2018-09-06 20:30:34 +02:00
Jan Malakhovski
8952375b48 nixos/shells: fix indent everywhere
to comply with `doc/coding-conventions.xml`
2018-08-30 13:20:39 +00:00
Tor Hedin Brønner
d273db48c6 nixos/shells: avoid overriding the environment for child shells
A shared exported guard `__NIXOS_SET_ENVIRONMENT_DONE` is introduced that can
be used to prevent child shells from sourcing `system.build.setEnvironment`
the second time.

This fixes e.g. `nix run derivation` when run from e.g. ZSH through the console or
ssh. Before this Bash would resource the common environment resetting the `PATH`
environment variable.

We also export `system.build.setEnvironment` to `/etc/set-environment` making it
easy to reset the common environment with `. /etc/set-environment` when
needed and to grep for environment variables in `/etc` (which was the
motivation of #30418).

This reverts changes made in b00a3fc6fd
(the original #30418).
2018-08-30 13:20:39 +00:00
Jörg Thalheim
4e365aa453 nixos/zsh: make enableGlobalCompInit description less ambiguous 2018-08-27 10:43:31 +01:00
Tobias Happ
17876c2cf1 nixos/zsh: Adds enableGlobalCompInit option 2018-08-19 12:57:06 +02:00
Maximilian Bosch
aa46b1ec0e nixos/autosuggestions: add module (#41397)
The `zsh-autosuggestions` package provides several configuration options
such as a different highlight style (like `fg=cyan` which is easier to
read).

With `rename.nix` the old `programs.zsh.enableAutosuggestions` is still
functional, but yields the following warning like this during evaluation:

```
trace: warning: The option `programs.zsh.enableAutosuggestions' defined in `<unknown-file>' has been renamed to `programs.zsh.autosuggestions.enable'.
```

The module provides the most common `zsh-autosuggestions` (highlight
style and strategy) as options that will be written into the interactive
shell init (`/etc/zshrc` by default). Further configuration options can
be declared using the `extraConfig` attr set:

```
{
  programs.zsh.autosuggestions.extraConfig = {
    "ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" = "buffer_size";
  };
}
```

A full list of available configuration options for `zsh-autosuggestions`
can be viewed here: https://github.com/zsh-users/zsh-autosuggestions/blob/v0.4.3/README.md
2018-06-10 23:08:50 +02:00
Matthew Bauer
2f68e86ce6 zsh: only do promptInit when TERM!=dumb
This allows tramp to be used correctly when default shell is zsh.
2018-05-31 12:34:16 -04:00
Gregor Kleen
effb02131c Revert "zsh: move setEnvironment stuff to zprofile"
This reverts commit 77a6cbb1c1.
2018-05-19 10:17:41 +02:00
jD91mZM2
77a6cbb1c1
zsh: move setEnvironment stuff to zprofile 2018-05-09 14:58:29 +02:00
Daiderd Jordan
db6fb869fb
Merge pull request #30418 from LnL7/inline-set-environment
nixos: inline set-environment for bash and zsh
2018-03-08 21:07:15 +01:00
Matthieu Coudron
d9ebd0d35b zsh doc: precise environment.shellAliases 2018-01-22 10:40:23 +09:00
Pierre Chevalier
b3de3893d0 nixos/zsh: add the type for enableAutosuggestions option
Simply a small inconsistency I picked up when reading that file.

fixes #31795
2017-11-18 21:27:12 +00:00
Daiderd Jordan
b00a3fc6fd
nixos: inline set-environment for bash and zsh 2017-10-14 21:19:07 +02:00
Franz Pletz
05c9a95d0e Merge pull request #28378 from Ma27/fix-zshrc-eval-order
programs.zsh: move evlauation of `${zshAliases}` after `cfg.interactiveShellInit`
2017-08-30 19:58:49 +02:00
Izorkin
520a43ced3 Fix zsh completions (#28550)
* Fix zsh completions

* Fix zsh completions (fix commit)

* Fix zsh completions (fix commit)
2017-08-25 09:34:21 +01:00
Maximilian Bosch
a73c721f3f
programs.zsh: move evlauation of ${zshAliases} after cfg.interactiveShellInit
`cfg.interactiveShellInit` is used by modules like
`programs.zsh.oh-my-zsh`. This means that all aliases defined in
`programs.zsh.shellAliases` might be overriden which is highly
unpredictable
2017-08-18 21:48:38 +02:00
Yacine Hmito
1f70f3801b Make zshrc more predictable
Originially, `programs.zsh` sets default values for some
initialisation scripts.
Nix resolves the case of multiple values by concatenating them all.
It is however impossible to predict where the default script will be
inserted; but we never want the default value to override the
user-specified ones.
Now, it doesn't set default values; almost everything is hardcoded at
the begining of the file.
2017-07-06 22:43:05 +02:00
Peter Simons
003cd41310 zsh: extend default $fpath configured by NixOS to find "vendor-completions" 2017-06-26 10:50:52 +02:00
Maximilian Bosch
0a12aafde4 zsh-syntax-highlighting: Add more configuration options and move to module (#25153)
* programs.zsh: factor zsh-syntax-highlighting out into its own module

* programs.zsh.syntax-highlighting: add `highlighters` option

* programs.zsh: document BC break introduced by moving zsh-syntax-completion into its own module
2017-04-23 21:17:31 +02:00
Maximilian Bosch
9ec64d2890 oh-my-zsh: add module (#25140)
* programs.zsh: add enableOhMyZsh option to automate setup of oh-my-zsh in global zshrc

* programs.zsh: make oh-my-zsh plugins configurable

* programs.zsh: add ohMyZshCustom option

* programs.zsh: add ohMyZshTheme option

* programs.zsh: applying minor fixes to evaluate expressions properly

* programs.zsh: fix ordering of oh-my-zsh config and execution

* programs.zsh: move all oh-my-zsh params into its own scope named programs.zsh.oh-my-zsh
2017-04-23 13:58:07 +02:00
gpyh
373e40736a Fix zshrc ordering
The content of programs.zsh.interactiveShellInit was
inserted too soon in the generated zshrc
This caused some settings related to autocompletion to be ignored
2017-01-11 22:03:27 +01:00