diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index 031442940b9e304..ce874a6e0b2d65e 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -79,7 +79,7 @@ In addition to numerous new and updated packages, this release has the following - [frigate](https://frigate.video), an open source NVR built around real-time AI object detection. Available as [services.frigate](#opt-services.frigate.enable). -- [fzf](https://github.com/junegunn/fzf), a command line fuzzyfinder. Available as [programs.fzf](#opt-programs.fzf.enable). +- [fzf](https://github.com/junegunn/fzf), a command line fuzzyfinder. Available as [programs.fzf](#opt-programs.fzf.fuzzyCompletion). - [gemstash](https://github.com/rubygems/gemstash), a RubyGems.org cache and private gem server. Available as [services.gemstash](#opt-services.gemstash.enable). diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index a5e8ab4addfa01b..e80f9e7a8634ca2 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -322,8 +322,6 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m - `xxd` has been moved from `vim` default output to its own output to reduce closure size. The canonical way to reference it across all platforms is `unixtools.xxd`. -- `programs.fzf.keybindings` and `programs.fzf.fuzzyCompletion` got replaced by `programs.fzf.enable` as shell-completion is included in the fzf-binary now there is no easy option to load completion and keybindings separately. Please consult fzf-documentation on how to configure/disable certain keybindings. - - The `stalwart-mail` package has been updated to v0.5.3, which includes [breaking changes](https://github.com/stalwartlabs/mail-server/blob/v0.5.3/UPGRADING.md). - `services.zope2` has been removed as `zope2` is unmaintained and was relying on Python2. diff --git a/nixos/modules/programs/fzf.nix b/nixos/modules/programs/fzf.nix index 05e39c43c11b8a3..d567f43b98226d9 100644 --- a/nixos/modules/programs/fzf.nix +++ b/nixos/modules/programs/fzf.nix @@ -1,46 +1,38 @@ { pkgs, config, lib, ... }: -with lib; - let cfg = config.programs.fzf; - + args = "${lib.optionalString (!cfg.fuzzyCompletion) " --no-completion"} ${lib.optionalString (!cfg.keybindings) " --no-key-bindings"}"; in { - imports = [ - (lib.mkRemovedOptionModule [ "programs" "fzf" "keybindings" ] '' - Use "programs.fzf.enable" 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.enable" 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.enable = mkEnableOption (mdDoc "fuzzy completion with fzf and keybindings"); + programs.fzf = { + fuzzyCompletion = lib.mkEnableOption (lib.mdDoc "fuzzy completion with fzf"); + keybindings = lib.mkEnableOption (lib.mdDoc "fzf keybindings"); + }; }; - config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.fzf ]; + config = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) { + environment.systemPackages = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) [ pkgs.fzf ]; - programs.bash.interactiveShellInit = '' - eval "$(${getExe pkgs.fzf} --bash)" - ''; - - programs.fish.interactiveShellInit = '' - ${getExe pkgs.fzf} --fish | source - ''; + programs = { + bash.interactiveShellInit = '' + eval "$(${lib.getExe pkgs.fzf} --bash ${args})" + ''; - programs.zsh = { - interactiveShellInit = optionalString (!config.programs.zsh.ohMyZsh.enable) '' - eval "$(${getExe pkgs.fzf} --zsh)" + fish.interactiveShellInit = '' + ${lib.getExe pkgs.fzf} --fish ${args}| source ''; - ohMyZsh.plugins = mkIf (config.programs.zsh.ohMyZsh.enable) [ "fzf" ]; + zsh = { + interactiveShellInit = lib.optionalString (!config.programs.zsh.ohMyZsh.enable) '' + eval "$(${lib.getExe pkgs.fzf} --zsh ${args})" + ''; + + ohMyZsh.plugins = lib.mkIf config.programs.zsh.ohMyZsh.enable [ "fzf" ]; + }; }; }; - meta.maintainers = with maintainers; [ laalsaas ]; + meta.maintainers = with lib.maintainers; [ laalsaas ]; } diff --git a/pkgs/tools/misc/fzf/default.nix b/pkgs/tools/misc/fzf/default.nix index 94ec13ead9e42f4..f8b20dd600d7fa0 100644 --- a/pkgs/tools/misc/fzf/default.nix +++ b/pkgs/tools/misc/fzf/default.nix @@ -1,6 +1,7 @@ { lib , buildGoModule , fetchFromGitHub +, fetchpatch , installShellFiles , bc , ncurses @@ -19,6 +20,14 @@ buildGoModule rec { hash = "sha256-XecMHKi5JMWx3RHQRk2FqS3SjyR6KzWjfyQ5JCI45xM="; }; + patches = [ + # add --no-key-bindings and --no-completion arguments + (fetchpatch { + url = "https://github.com/junegunn/fzf/pull/3722/commits/741babf958e1cd1593a2ed081e92bd7f157a7464.patch"; + hash = "sha256-IxIbTG/rXMPLmul2t3tIJa3uFMhSmR8CM5NluyoHM98="; + }) + ]; + vendorHash = "sha256-ZEwB2GKohmOx8xosj14VII6sQ4a82s7+h9r620MKEeU="; CGO_ENABLED = 0;