From e3812e187592c866349630cc097c786b353130c7 Mon Sep 17 00:00:00 2001 From: Sebastian Sellmeier Date: Sun, 24 Mar 2024 18:28:11 +0100 Subject: fzf: Update package and module (shell-completions) Update derivation to not install old shell-completions Update module to load completion for bash, fish (new) and zsh (or oh-my-zsh plugin) with changed way through fzf-binary Added change to release note as it is backwards-incompatible. --- nixos/doc/manual/release-notes/rl-2305.section.md | 2 +- nixos/doc/manual/release-notes/rl-2405.section.md | 2 + nixos/modules/programs/fzf.nix | 48 +++++++++++++++-------- 3 files changed, 34 insertions(+), 18 deletions(-) (limited to 'nixos') diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index 21c798b3b4a46..53e30979645e5 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -77,7 +77,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.fuzzyCompletion). +- [fzf](https://github.com/junegunn/fzf), a command line fuzzyfinder. Available as [programs.fzf](#opt-programs.fzf.enable). - [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 19ff6f4485cd0..645a6cdb7809f 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -248,6 +248,8 @@ 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.enabled` 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 7c4f338e29b30..b4d05efc8ba98 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 seperatly. + 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 seperatly. + 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 = '' + eval "$(${getExe pkgs.fzf} --fish)" ''; - 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 ]; } -- cgit 1.4.1 From 9d27034ebaef4dcca1cff0d966703cfbe38d65d7 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 7 Apr 2024 04:20:00 +0000 Subject: nixos/fzf: fix fish shell commmand --- nixos/modules/programs/fzf.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/programs/fzf.nix b/nixos/modules/programs/fzf.nix index b4d05efc8ba98..24fca7b332918 100644 --- a/nixos/modules/programs/fzf.nix +++ b/nixos/modules/programs/fzf.nix @@ -9,11 +9,11 @@ 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 seperatly. + 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 seperatly. + 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. '') ]; @@ -30,7 +30,7 @@ in ''; programs.fish.interactiveShellInit = '' - eval "$(${getExe pkgs.fzf} --fish)" + ${getExe pkgs.fzf} --fish | source ''; programs.zsh = { -- cgit 1.4.1