nixos/bash-completion: move options to programs.bash.completion, add package option, drop with lib
This allows to easily test bash-completion updates without triggering a mass rebuild locally.
This commit is contained in:
parent
7ce8977edb
commit
1c60f0a9a0
@ -1,16 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
enable = config.programs.bash.enableCompletion;
|
||||
cfg = config.programs.bash;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.bash.enableCompletion = lib.mkEnableOption "Bash completion for all interactive bash shells" // {
|
||||
options.programs.bash.completion = {
|
||||
enable = lib.mkEnableOption "Bash completion for all interactive bash shells" // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
package = lib.mkPackageOption pkgs "bash-completion" { };
|
||||
};
|
||||
|
||||
config = lib.mkIf enable {
|
||||
imports = [
|
||||
(lib.mkRenamedOptionModule [ "programs" "bash" "enableCompletion" ] [ "programs" "bash" "completion" "enable" ])
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.completion.enable {
|
||||
programs.bash.promptPluginInit = ''
|
||||
# Check whether we're running a version of Bash that has support for
|
||||
# programmable completion. If we do, enable all modules installed in
|
||||
@ -19,7 +25,7 @@ in
|
||||
# $XDG_DATA_DIRS/bash-completion/completions/
|
||||
# on demand, so they do not need to be sourced here.
|
||||
if shopt -q progcomp &>/dev/null; then
|
||||
. "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
|
||||
. "${cfg.completion.package}/etc/profile.d/bash_completion.sh"
|
||||
nullglobStatus=$(shopt -p nullglob)
|
||||
shopt -s nullglob
|
||||
for p in $NIX_PROFILES; do
|
||||
|
@ -198,7 +198,7 @@ in
|
||||
|
||||
users.defaultUserShell = lib.mkDefault pkgs.bashInteractive;
|
||||
|
||||
environment.pathsToLink = lib.optionals cfg.enableCompletion [
|
||||
environment.pathsToLink = lib.optionals cfg.completion.enable [
|
||||
"/etc/bash_completion.d"
|
||||
"/share/bash-completion"
|
||||
];
|
||||
|
@ -15,7 +15,7 @@ in
|
||||
environment.systemPackages = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) [ pkgs.fzf ];
|
||||
|
||||
programs = {
|
||||
# load after programs.bash.enableCompletion
|
||||
# load after programs.bash.completion.enable
|
||||
bash.promptPluginInit = lib.mkAfter (lib.optionalString cfg.fuzzyCompletion ''
|
||||
source ${pkgs.fzf}/share/fzf/completion.bash
|
||||
'' + lib.optionalString cfg.keybindings ''
|
||||
|
@ -164,7 +164,7 @@ in
|
||||
nixPackage
|
||||
pkgs.nix-info
|
||||
]
|
||||
++ optional (config.programs.bash.enableCompletion) pkgs.nix-bash-completions;
|
||||
++ optional (config.programs.bash.completion.enable) pkgs.nix-bash-completions;
|
||||
|
||||
systemd.packages = [ nixPackage ];
|
||||
|
||||
|
@ -47,7 +47,7 @@ let
|
||||
'') (attrValues nodes);
|
||||
};
|
||||
};
|
||||
programs.bash.enableCompletion = true;
|
||||
programs.bash.completion.enable = true;
|
||||
environment.systemPackages = [ wrapKubectl ];
|
||||
services.flannel.iface = "eth1";
|
||||
services.kubernetes = {
|
||||
|
Loading…
Reference in New Issue
Block a user