diff options
author | laalsaas <laalsaas@systemli.org> | 2022-11-11 21:08:36 +0100 |
---|---|---|
committer | laalsaas <laalsaas@systemli.org> | 2022-12-03 03:14:21 +0100 |
commit | 257a832e61e9058527ad5a8990786218240f6a84 (patch) | |
tree | 81ef4398bcf13a94b4c43bedf401963b08f464c1 /nixos/modules/programs | |
parent | 123cdd499040fac090267246a254d424e70f68e4 (diff) |
fzf: init module
Diffstat (limited to 'nixos/modules/programs')
-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 ]; +} |