Commit Graph

45 Commits

Author SHA1 Message Date
K900
784330e275 treewide: nuke remaining mdDoc leftovers
bors when
2024-04-15 20:12:24 +03:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
nicoo
3222262ff1 nixos/bash: Drop workarounds for eterm 2023-09-12 13:10:41 +00: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
pennae
da37ca6760 nixos/programs: invariant option docs MD conversions 2022-07-24 13:01:18 +02:00
Anders Kaseorg
d44b6ae6cb modules/programs/bash: Fix ShellCheck warnings
https://github.com/koalaman/shellcheck/wiki/SC2086
Double quote to prevent globbing and word splitting.

https://github.com/koalaman/shellcheck/wiki/SC2166
Prefer `[ p ] && [ q ]` as `[ p -a q ]` is not well defined.

https://github.com/koalaman/shellcheck/wiki/SC2219
Instead of `let expr`, prefer `(( expr ))` .

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-09-06 08:49:34 +09:00
Kira Bruneau
62a78fc361 modules/programs/bash: move prompt plugins into separate modules 2021-05-03 14:24:24 -04:00
Eelco Dolstra
bbfc47326b Don't enable nix-bash-completions when using Nix 2.4
2.4 has its own completion script which collides with
nix-bash-completions.
2020-06-04 14:18:18 +02:00
Sean Buckley
83c36ee797 nixos/bash: configure $LS_COLORS for interactive shells 2020-01-28 00:11:43 -05: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
Frederik Rietdijk
ad1d58c622 Merge staging-next into staging 2019-08-31 10:04:20 +02:00
Vika
844200a06f
nixos/bash: Improve Emacs detection for PS1
That's one of my itches - when I'm sshing from Emacs' term to a NixOS
machine, it doesn't detect that I'm running emacs and showing a title
escape sequence. This commit fixes it, checking against $TERM to
prevent this from ever bothering anyone again.
2019-08-30 00:28:57 +03:00
volth
35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00: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
Bob van der Linden
bad7d82487 nixos/bash: do not use /var/run 2019-03-20 00:01:45 +01:00
Linus Heckemann
efbd24ffcc nixos/bash: fix root prompt
b4b67177b5 introduced a regression of
its own: the prompt would end with $ for all users, not with # for
root as it should.
2019-03-05 13:27:32 +01:00
Tad Fisher
b4b67177b5 nixos/bash: Fix prompt regression in Emacs term mode 2018-12-17 15:42:41 -08:00
Yegor Timoshenko
d53077b20c
nixos/bash: set title in PS1 2018-12-07 22:42:55 +03:00
Robert Hensing
c4f6745e72
nixos: programs.bash: Fix comment about completion
`XDG_DATA_DIRS` already includes what is typically the `share` directory.
Adding an extra `share` breaks it.
2018-11-04 13:06:13 +01: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
c74d
d8bcd2c3d8 nixos/bash: Use escapeShellArg for shell aliases
This patch uses the library function `lib.escapeShellArg` to improve
the handling of shell aliases in the NixOS module `bash`, copying the
corresponding change made to the `zsh` module in commit
1e211a70cb (for which GitHub pull
request #47471 was filed).

This patch resolves GitHub issue #16973.

This change presumably also should be copied to the `fish` module, but
I don't know `fish` syntax so that won't be done by me.

GitHub: Close NixOS/nixpkgs#16973.
2018-10-06 20:01:27 +00: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
Bjørn Forsman
80b6513fbf nixos: enable bash command completion by default
Because it improves out-of-the-box user experience a lot (IMHO).
(zsh completion is already on by default.)

Remove "programs.bash.enableCompletion = true" from
nixos-generate-config.pl, which feels superflous now.
2018-04-13 18:36:51 +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
Tor Hedin Brønner
c58072309c programs/bash: install nix-bash-completions if completion is enabled 2018-02-28 19:13:02 +01:00
Orivej Desh
42973bef3f nixos/programs/bash: document that /etc/bash_completion.d is obsolete
fbd52a5e31/bash_completion (L2070-L2078)
2017-12-10 12:16:25 +00:00
Tor Hedin Brønner
9988224c2a nixos/programs/bash: Let bash-completion lazy load scripts
As described in detail here: https://github.com/NixOS/nixpkgs/issues/32533
bash will load completion scripts in $p/share/bash-completion/completions/ on
startup instead of letting bash-completion do it's lazy loading. Bash startup
will then slow down (very noticeable when bash-completion is installed in a
profile).

This commit leaves loading of scripts in the hands of bash-completion,
improving startup time for everyone using `enableCompletion`.

fixes #32533
2017-12-10 10:15:41 +01:00
Robert Helgesson
101d56cb0c
nixos/bash: mark inputrc etc file as default
The bash module currently sets the `/etc/inputrc` unconditionally,
which prevents easy user override. This commit lowers the priority of
the setting to "option default" level, which allows a user to override
the value using either

    environment.etc."inputrc".text = …

or

    environment.etc."inputrc".source = …
2017-11-20 12:32:01 +01:00
Daiderd Jordan
b00a3fc6fd
nixos: inline set-environment for bash and zsh 2017-10-14 21:19:07 +02:00
Robert Helgesson
e8817a2d20
bash-completion: change attribute name
This changes the attribute name of bash-completion from `bashCompletion`
to `bash-completion`. Keeps `bashCompletion` as an alias for the new
name.
2016-09-28 17:46:29 +02:00
zimbatm
2974b6f4c8 Use shell packages to select the user's shell
The string type is still available for backward-compatiblity.
2016-06-12 20:35:34 +01:00
Eelco Dolstra
cd396076ec Revert "Revert "Remove which -> type -P alias.""
This reverts commit ddd480ac30. Gave it
some more thought.
2016-04-18 14:20:49 +02:00
Eelco Dolstra
ddd480ac30 Revert "Remove which -> type -P alias."
This reverts commit e8e8164f348a0e8655e1d50a7a404bdc62055f4e. I
misread the original commit as adding the "which" package, but it only
adds it to base.nix. So then the original motivation (making it work
in subshells) doesn't hold. Note that we already have some convenience
aliases that don't work in subshells either (such as "ll").
2016-03-25 17:17:07 +01:00
Domen Kožar
73ba0ae2de Remove which -> type -P alias.
Aliases are not the same as programs. They won't work in subshells.
It's better to just use which as it's only 88K.
2016-03-03 16:15:25 +00:00
Peter Simons
0ccc515b48 nixos: remove debug code accidentally checked in with 833a597156 2015-11-18 16:37:38 +01:00
Peter Simons
833a597156 nixos: configure bash prompt in Emacs' shell-mode, even if TERM=dumb
The idea that the interactive bash prompt isn't set in case of TERM=dumb
is intended to fix problems when other machines log remotely into a
NixOS installation via Tramp. A side-effect that change was, however,
that Emacs' shell-mode no longer had a correct prompt. I suppose the
presence of

  INSIDE_EMACS=24.5.2,comint

is a sufficiently unique indication that the current interactive shell
is running inside of an Emacs and that the prompt can thus be configured
safely.
2015-11-18 16:27:41 +01:00
Nikolay Amiantov
7a9982d465 nixos/bash: use simple prompt for dumb terminals 2015-10-22 14:05:49 +03:00
Eelco Dolstra
bde9ae18cf Revert "enable bash autocomplete by default"
This reverts commit ee8e15fe76. See
discussion at ee8e15fe76.
2014-12-18 00:36:46 +01:00
Domen Kožar
ee8e15fe76 enable bash autocomplete by default 2014-12-08 12:06:02 +01:00
Eelco Dolstra
90dac235bb Remove the option ‘programs.bash.enable’
NixOS has a pervasive dependency on bash. For instance, the X11
session script sources /etc/profile to get a reasonable
environment. Thus we should not provide an option to disable bash.

Also, enabling zsh no longer sets ‘users.defaultUserShell’ to zsh, to
prevent a collision with bash's definition of the same
option. (Changing the default shell is also something that should be
left to the user.)
2014-04-29 19:00:39 +02:00
Eelco Dolstra
29027fd1e1 Rewrite ‘with pkgs.lib’ -> ‘with lib’
Using pkgs.lib on the spine of module evaluation is problematic
because the pkgs argument depends on the result of module
evaluation. To prevent an infinite recursion, pkgs and some of the
modules are evaluated twice, which is inefficient. Using ‘with lib’
prevents this problem.
2014-04-14 16:26:48 +02:00
Domen Kožar
cf3e36a3b9 bash: place interactiveShellInit at the end to be able to override existing settings 2013-10-11 11:55:58 +02:00
Eelco Dolstra
5c1f8cbc70 Move all of NixOS to nixos/ in preparation of the repository merge 2013-10-10 13:28:20 +02:00