diff options
Diffstat (limited to 'nixos/modules/programs/fzf.nix')
-rw-r--r-- | nixos/modules/programs/fzf.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/nixos/modules/programs/fzf.nix b/nixos/modules/programs/fzf.nix new file mode 100644 index 0000000000000..0452bf4262276 --- /dev/null +++ b/nixos/modules/programs/fzf.nix @@ -0,0 +1,37 @@ +{pkgs, config, lib, ...}: +with lib; +let + cfg = config.programs.fzf; +in { + options = { + programs.fzf = { + fuzzyCompletion = mkOption { + type = types.bool; + description = lib.mdDoc "Whether to use fzf for fuzzy completion"; + default = false; + example = true; + }; + keybindings = mkOption { + type = types.bool; + description = lib.mdDoc "Whether to set up fzf keybindings"; + default = false; + example = true; + }; + }; + }; + config = { + environment.systemPackages = optional (cfg.keybindings || cfg.fuzzyCompletion) pkgs.fzf; + programs.bash.interactiveShellInit = optionalString cfg.fuzzyCompletion '' + source ${pkgs.fzf}/share/fzf/completion.bash + '' + optionalString cfg.keybindings '' + source ${pkgs.fzf}/share/fzf/key-bindings.bash + ''; + + programs.zsh.interactiveShellInit = optionalString cfg.fuzzyCompletion '' + source ${pkgs.fzf}/share/fzf/completion.zsh + '' + optionalString cfg.keybindings '' + source ${pkgs.fzf}/share/fzf/key-bindings.zsh + ''; + }; + meta.maintainers = with maintainers; [ laalsaas ]; +} |