mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 06:14:57 +01:00
1c60f0a9a0
This allows to easily test bash-completion updates without triggering a mass rebuild locally.
39 lines
1.2 KiB
Nix
39 lines
1.2 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
|
|
let
|
|
cfg = config.programs.fzf;
|
|
in
|
|
{
|
|
options = {
|
|
programs.fzf = {
|
|
fuzzyCompletion = lib.mkEnableOption "fuzzy completion with fzf";
|
|
keybindings = lib.mkEnableOption "fzf keybindings";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) {
|
|
environment.systemPackages = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) [ pkgs.fzf ];
|
|
|
|
programs = {
|
|
# 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 ''
|
|
source ${pkgs.fzf}/share/fzf/key-bindings.bash
|
|
'');
|
|
|
|
zsh = {
|
|
interactiveShellInit = lib.optionalString (!config.programs.zsh.ohMyZsh.enable)
|
|
(lib.optionalString cfg.fuzzyCompletion ''
|
|
source ${pkgs.fzf}/share/fzf/completion.zsh
|
|
'' + lib.optionalString cfg.keybindings ''
|
|
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
|
'');
|
|
|
|
ohMyZsh.plugins = lib.mkIf config.programs.zsh.ohMyZsh.enable [ "fzf" ];
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with lib.maintainers; [ laalsaas ];
|
|
}
|