diff options
Diffstat (limited to 'nixos/modules/programs/fzf.nix')
-rw-r--r-- | nixos/modules/programs/fzf.nix | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/nixos/modules/programs/fzf.nix b/nixos/modules/programs/fzf.nix index 7c4f338e29b30..24fca7b332918 100644 --- a/nixos/modules/programs/fzf.nix +++ b/nixos/modules/programs/fzf.nix @@ -1,32 +1,46 @@ { pkgs, config, lib, ... }: + with lib; + let cfg = config.programs.fzf; + in { + imports = [ + (lib.mkRemovedOptionModule [ "programs" "fzf" "keybindings" ] '' + Use "programs.fzf.enabled" instead, due to fzf upstream-change it's not possible to load shell-completion and keybindings separately. + If you want to change/disable certain keybindings please check the fzf-documentation. + '') + (lib.mkRemovedOptionModule [ "programs" "fzf" "fuzzyCompletion" ] '' + Use "programs.fzf.enabled" instead, due to fzf upstream-change it's not possible to load shell-completion and keybindings separately. + If you want to change/disable certain keybindings please check the fzf-documentation. + '') + ]; + options = { - programs.fzf = { - fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with fzf"); - keybindings = mkEnableOption (mdDoc "fzf keybindings"); - }; + programs.fzf.enable = mkEnableOption (mdDoc "fuzzy completion with fzf and keybindings"); }; - 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 + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.fzf ]; + + programs.bash.interactiveShellInit = '' + eval "$(${getExe pkgs.fzf} --bash)" + ''; + + programs.fish.interactiveShellInit = '' + ${getExe pkgs.fzf} --fish | source ''; - programs.zsh.interactiveShellInit = optionalString (!config.programs.zsh.ohMyZsh.enable) - (optionalString cfg.fuzzyCompletion '' - source ${pkgs.fzf}/share/fzf/completion.zsh - '' + optionalString cfg.keybindings '' - source ${pkgs.fzf}/share/fzf/key-bindings.zsh - ''); + programs.zsh = { + interactiveShellInit = optionalString (!config.programs.zsh.ohMyZsh.enable) '' + eval "$(${getExe pkgs.fzf} --zsh)" + ''; - programs.zsh.ohMyZsh.plugins = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) [ "fzf" ]; + ohMyZsh.plugins = mkIf (config.programs.zsh.ohMyZsh.enable) [ "fzf" ]; + }; }; + meta.maintainers = with maintainers; [ laalsaas ]; } |