Commit Graph

113 Commits

Author SHA1 Message Date
Izorkin
9fdf7027cc
nixos/zsh: allow fqdn hostname output 2023-04-01 13:56:51 +03:00
pennae
0a6e6cf7e6 nixos/manual: render module chapters with nixos-render-docs
this converts meta.doc into an md pointer, not an xml pointer. since we
no longer need xml for manual chapters we can also remove support for
manual chapters from md-to-db.sh

since pandoc converts smart quotes to docbook quote elements and our
nixos-render-docs does not we lose this distinction in the rendered
output. that's probably not that bad, our stylesheet didn't make use of
this anyway (and pre-23.05 versions of the chapters didn't use quote
elements either).

also updates the nixpkgs manual to clarify that option docs support all
extensions (although it doesn't support headings at all, so heading
anchors don't work by extension).
2023-01-27 20:07:34 +01:00
Ryan Lahfa
33231c337e
Merge pull request #209538 from voidzero/zsh-syntax-hl.regexp
zsh-syntax-highlighting: add regexp to list of highlighters
2023-01-15 00:26:10 +01:00
pennae
53fc887582 nixos/manual: move "edit the MD file" comments to generated XML 2023-01-10 12:34:37 +01:00
pennae
bf92eaebe4 nixos/manual: generate module chapters with md-to-db.sh 2023-01-10 10:32:00 +01:00
pennae
23ea73b416 nixos/manual: enable smart quotes for all MD chapters 2023-01-10 10:31:59 +01:00
pennae
f60e9eac85 nixos/oh-my-zsh: convert manual chapter to MD 2023-01-10 10:31:54 +01:00
pennae
6930425922 nixos/manual: normalize <literal><link> -> <link><literal>
MD can only do the latter, so change them all over now to keeps diffs reviewable.

this also includes <literal><xref> -> <xref> where options are referenced since
the reference will implicitly add an inner literal tag.
2023-01-10 10:31:52 +01:00
voidzero
29749d22a3 zsh-syntax-highlighting: add regexp to list of highlighters 2023-01-07 19:39:31 +01:00
Jörg Thalheim
c48d83b7bf
Merge pull request #197536 from eigengrau/zsh-init-no-unset
nixos/zsh: don’t be noisy when scripts are run with -u
2022-11-16 09:46:39 +01:00
Sebastian Reuße
5764782921 nixos/shells: support defining aliases beginning with a dash or plus
Both Zsh and Bash support aliases that begin with characters also used to
indicate options to the “alias” built-in command, as long as the alias
definition is preceeded by a double dash.

This allows, e.g, for “alias -- +x=chmod +x”.
2022-10-28 08:37:05 +02:00
Sebastian Reuße
7d84dbdf5b nixos/zsh: don’t be noisy when scripts are run with -u
When a script specifies the shell option “nounset” as part of the shebang (e.g.,
via “#!/usr/bin/env -S zsh -u”), our initialization scripts would produce error
messages of the form:

    __ETC_FOO_SOURCED: parameter not set

These messages could probably be confusing to users when running such scripts.
By providing a fall-back in the parameter expansion, we can avoid them.

This patch does not address interactive shell start-up, where such messages may
(or may not) be less problematic.
2022-10-24 14:22:50 +02:00
Sebastian Reuße
8dad5a2239 nixos/zsh: prefer added completions over completions shipped with Zsh
Zsh ships some rudimentary completions for programs where upstream also ships
their own completions (e.g., curl). So as not to shadow those completions, we
need to prepend to the fpath instead of appending.

Fixes #197502
2022-10-24 09:27:19 +02:00
pennae
ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae
7e7d68a250 nixos/*: mark pre-existing markdown descriptions as mdDoc 2022-08-19 22:40:58 +02:00
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
Ryan Gibb
34b5dd453b nixos/zsh-autosuggestions: ZSH_AUTOSUGGEST_STRATEGY array
zsh-autosuggestions supports having fallback strategies expressed
through the ZSH_AUTOSUGGEST_STRATEGY array. For example,
`ZSH_AUTOSUGGEST_STRATEGY=(history completion)`. We should also support
this.
2022-03-07 16:29:00 +00: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
Sandro
fef107d5a5
Merge pull request #142839 from ivan/zsh-autosuggestions-config-async 2021-11-25 00:09:18 +01:00
Ivan Kozik
b897f5fe70 nixos/autosuggestions: add config to control whether suggestions are async
zsh-autosuggestions now defaults to asynchronous suggestions, but they can
be annoying when they take several frames longer to show up after typing.
2021-11-19 01:09:44 +00: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
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02: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
Daniël de Kok
7b73713a98 programs.zsh: remove unnecessary with 2020-09-03 08:42:24 +02:00
Benjamin Asbach
cbb5b578b8 zsh: added option to enable compatibility with bash's completion system 2020-05-03 12:08:25 +02:00
Dominik Xaver Hörl
0412bde942 treewide: add bool type to enable options, or make use of mkEnableOption
Add missing type information to manually specified enable options or replace them by mkEnableOption where appropriate.
2020-04-21 08:55:36 +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
Silvan Mosberger
4ee3e8b21d
nixos/treewide: Move rename.nix imports to their respective modules
A centralized list for these renames is not good because:
- It breaks disabledModules for modules that have a rename defined
- Adding/removing renames for a module means having to find them in the
central file
- Merge conflicts due to multiple people editing the central file
2019-12-10 02:51:19 +01:00
Silva Alejandro Ismael
35ae47e44b nixos/zsh-syntax-highlighting: Fix highlighting when ohMyZsh is enabled
From https://github.com/zsh-users/zsh-syntax-highlighting#faq:

"It must be sourced after all custom widgets have been created
(i.e., after all zle -N calls and after running compinit)."

zsh-syntax-highlighting must be sourced to the end.
2019-10-23 11:54:52 -03:00
Eelco Dolstra
b0ccd6dd16
Revert "nixos/doc: re-format"
This reverts commit ea6e8775bd. The new
format is not an improvement.
2019-09-19 19:17:30 +02:00
Jan Tojnar
ea6e8775bd
nixos/doc: re-format 2019-09-18 22:13:35 +02:00
Vladimír Čunát
f21211ebfe
Merge branch 'master' into staging 2019-09-02 23:25:24 +02:00
Silvan Mosberger
478e7184f8
nixos/modules: Remove all usages of types.string
And replace them with a more appropriate type

Also fix up some minor module problems along the way
2019-08-31 18:19:00 +02: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