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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user