mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
Merge pull request #1097 from isabelroses/bash/completions
programs/bash: move to completion.*
This commit is contained in:
commit
48b50b3b13
4 changed files with 22 additions and 14 deletions
|
@ -12,7 +12,7 @@ in
|
||||||
{
|
{
|
||||||
# Create /etc/bashrc that loads the nix-darwin environment.
|
# Create /etc/bashrc that loads the nix-darwin environment.
|
||||||
programs.bash.enable = true;
|
programs.bash.enable = true;
|
||||||
programs.bash.enableCompletion = false;
|
programs.bash.completion.enable = false;
|
||||||
|
|
||||||
# Recreate /run/current-system symlink after boot.
|
# Recreate /run/current-system symlink after boot.
|
||||||
services.activate-system.enable = true;
|
services.activate-system.enable = true;
|
||||||
|
|
|
@ -199,7 +199,7 @@
|
||||||
# Dotfiles.
|
# Dotfiles.
|
||||||
# programs.vim.package = mkForce pkgs.lnl.vim;
|
# programs.vim.package = mkForce pkgs.lnl.vim;
|
||||||
|
|
||||||
programs.bash.enableCompletion = true;
|
programs.bash.completion.enable = true;
|
||||||
|
|
||||||
programs.zsh.enable = true;
|
programs.zsh.enable = true;
|
||||||
programs.zsh.enableBashCompletion = true;
|
programs.zsh.enableBashCompletion = true;
|
||||||
|
|
|
@ -686,7 +686,7 @@ in
|
||||||
nixPackage
|
nixPackage
|
||||||
pkgs.nix-info
|
pkgs.nix-info
|
||||||
]
|
]
|
||||||
++ optional (config.programs.bash.enableCompletion) pkgs.nix-bash-completions;
|
++ optional (config.programs.bash.completion.enable) pkgs.nix-bash-completions;
|
||||||
|
|
||||||
environment.etc."nix/nix.conf".source = nixConf;
|
environment.etc."nix/nix.conf".source = nixConf;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule [ "programs" "bash" "enableCompletion" ] [ "programs" "bash" "completion" "enable" ])
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
programs.bash.enable = mkOption {
|
programs.bash.enable = mkOption {
|
||||||
|
@ -21,14 +25,18 @@ in
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.bash.enableCompletion = mkOption {
|
programs.bash.completion = {
|
||||||
type = types.bool;
|
enable = mkOption {
|
||||||
default = false;
|
type = types.bool;
|
||||||
description = ''
|
default = false;
|
||||||
Enable bash completion for all interactive bash shells.
|
description = ''
|
||||||
|
Enable bash completion for all interactive bash shells.
|
||||||
|
|
||||||
NOTE. This doesn't work with bash 3.2, which is the default on macOS.
|
NOTE: This doesn't work with bash 3.2, which is installed by default on macOS by Apple.
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "bash-completion" { };
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -38,9 +46,9 @@ in
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
[ # Include bash package
|
[ # Include bash package
|
||||||
pkgs.bashInteractive
|
pkgs.bashInteractive
|
||||||
] ++ optional cfg.enableCompletion pkgs.bash-completion;
|
] ++ optional cfg.completion.enable cfg.completion.package;
|
||||||
|
|
||||||
environment.pathsToLink =
|
environment.pathsToLink = optionals cfg.completion.enable
|
||||||
[ "/etc/bash_completion.d"
|
[ "/etc/bash_completion.d"
|
||||||
"/share/bash-completion/completions"
|
"/share/bash-completion/completions"
|
||||||
];
|
];
|
||||||
|
@ -70,9 +78,9 @@ in
|
||||||
${config.environment.interactiveShellInit}
|
${config.environment.interactiveShellInit}
|
||||||
${cfg.interactiveShellInit}
|
${cfg.interactiveShellInit}
|
||||||
|
|
||||||
${optionalString cfg.enableCompletion ''
|
${optionalString cfg.completion.enable ''
|
||||||
if [ "$TERM" != "dumb" ]; then
|
if [ "$TERM" != "dumb" ]; then
|
||||||
source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
|
source "${cfg.completion.package}/etc/profile.d/bash_completion.sh"
|
||||||
|
|
||||||
nullglobStatus=$(shopt -p nullglob)
|
nullglobStatus=$(shopt -p nullglob)
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
Loading…
Reference in a new issue