lol

nixos/fzf: bring back keybindings and completion option removed in #298692

Also drop with lib

+32 -33
+1 -1
nixos/doc/manual/release-notes/rl-2305.section.md
··· 79 79 80 80 - [frigate](https://frigate.video), an open source NVR built around real-time AI object detection. Available as [services.frigate](#opt-services.frigate.enable). 81 81 82 - - [fzf](https://github.com/junegunn/fzf), a command line fuzzyfinder. Available as [programs.fzf](#opt-programs.fzf.enable). 82 + - [fzf](https://github.com/junegunn/fzf), a command line fuzzyfinder. Available as [programs.fzf](#opt-programs.fzf.fuzzyCompletion). 83 83 84 84 - [gemstash](https://github.com/rubygems/gemstash), a RubyGems.org cache and private gem server. Available as [services.gemstash](#opt-services.gemstash.enable). 85 85
-2
nixos/doc/manual/release-notes/rl-2405.section.md
··· 322 322 323 323 - `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`. 324 324 325 - - `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. 326 - 327 325 - 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). 328 326 329 327 - `services.zope2` has been removed as `zope2` is unmaintained and was relying on Python2.
+22 -30
nixos/modules/programs/fzf.nix
··· 1 1 { pkgs, config, lib, ... }: 2 2 3 - with lib; 4 - 5 3 let 6 4 cfg = config.programs.fzf; 7 - 8 5 in 9 6 { 10 - imports = [ 11 - (lib.mkRemovedOptionModule [ "programs" "fzf" "keybindings" ] '' 12 - Use "programs.fzf.enable" instead, due to fzf upstream-change it's not possible to load shell-completion and keybindings separately. 13 - If you want to change/disable certain keybindings please check the fzf-documentation. 14 - '') 15 - (lib.mkRemovedOptionModule [ "programs" "fzf" "fuzzyCompletion" ] '' 16 - Use "programs.fzf.enable" instead, due to fzf upstream-change it's not possible to load shell-completion and keybindings separately. 17 - If you want to change/disable certain keybindings please check the fzf-documentation. 18 - '') 19 - ]; 20 - 21 7 options = { 22 - programs.fzf.enable = mkEnableOption (mdDoc "fuzzy completion with fzf and keybindings"); 8 + programs.fzf = { 9 + fuzzyCompletion = lib.mkEnableOption (lib.mdDoc "fuzzy completion with fzf"); 10 + keybindings = lib.mkEnableOption (lib.mdDoc "fzf keybindings"); 11 + }; 23 12 }; 24 13 25 - config = mkIf cfg.enable { 26 - environment.systemPackages = [ pkgs.fzf ]; 27 - 28 - programs.bash.interactiveShellInit = '' 29 - eval "$(${getExe pkgs.fzf} --bash)" 30 - ''; 31 - 32 - programs.fish.interactiveShellInit = '' 33 - ${getExe pkgs.fzf} --fish | source 34 - ''; 14 + config = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) { 15 + environment.systemPackages = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) [ pkgs.fzf ]; 35 16 36 - programs.zsh = { 37 - interactiveShellInit = optionalString (!config.programs.zsh.ohMyZsh.enable) '' 38 - eval "$(${getExe pkgs.fzf} --zsh)" 17 + programs = { 18 + bash.interactiveShellInit = lib.optionalString cfg.fuzzyCompletion '' 19 + source ${pkgs.fzf}/share/fzf/completion.bash 20 + '' + lib.optionalString cfg.keybindings '' 21 + source ${pkgs.fzf}/share/fzf/key-bindings.bash 39 22 ''; 40 23 41 - ohMyZsh.plugins = mkIf (config.programs.zsh.ohMyZsh.enable) [ "fzf" ]; 24 + zsh = { 25 + interactiveShellInit = lib.optionalString (!config.programs.zsh.ohMyZsh.enable) 26 + (lib.optionalString cfg.fuzzyCompletion '' 27 + source ${pkgs.fzf}/share/fzf/completion.zsh 28 + '' + lib.optionalString cfg.keybindings '' 29 + source ${pkgs.fzf}/share/fzf/key-bindings.zsh 30 + ''); 31 + 32 + ohMyZsh.plugins = lib.mkIf config.programs.zsh.ohMyZsh.enable [ "fzf" ]; 33 + }; 42 34 }; 43 35 }; 44 36 45 - meta.maintainers = with maintainers; [ laalsaas ]; 37 + meta.maintainers = with lib.maintainers; [ laalsaas ]; 46 38 }
+9
pkgs/tools/misc/fzf/default.nix
··· 55 55 install -D plugin/* -t $out/share/vim-plugins/${pname}/plugin 56 56 mkdir -p $out/share/nvim 57 57 ln -s $out/share/vim-plugins/${pname} $out/share/nvim/site 58 + 59 + # Install shell integrations 60 + install -D shell/* -t $out/share/fzf/ 61 + install -D shell/key-bindings.fish $out/share/fish/vendor_functions.d/fzf_key_bindings.fish 62 + mkdir -p $out/share/fish/vendor_conf.d 63 + cat << EOF > $out/share/fish/vendor_conf.d/load-fzf-key-bindings.fish 64 + status is-interactive; or exit 0 65 + fzf_key_bindings 66 + EOF 58 67 ''; 59 68 60 69 passthru.tests.version = testers.testVersion {