1 { lib, buildGoModule, fetchFromGitHub, writeText, runtimeShell, ncurses, perl }:
7 src = fetchFromGitHub {
11 sha256 = "sha256-q0rAAD6du0WLcd46LUpkG3gBIvmtOE/foEMW5QCoIak=";
14 vendorSha256 = "sha256-FKDCIotyra/TZ48wbpzudJZ2aI2pn+ZR4EoZ+9+19Mw=";
16 outputs = [ "out" "man" ];
18 fishHook = writeText "load-fzf-keybindings.fish" "fzf_key_bindings";
20 buildInputs = [ ncurses ];
23 "-ldflags=-s -w -X main.version=${version} -X main.revision=${src.rev}"
26 # The vim plugin expects a relative path to the binary; patch it to abspath.
28 sed -i -e "s|expand('<sfile>:h:h')|'$out'|" plugin/fzf.vim
30 if ! grep -q $out plugin/fzf.vim; then
31 echo "Failed to replace vim base_dir path with $out"
35 # Has a sneaky dependency on perl
36 # Include first args to make sure we're patching the right thing
37 substituteInPlace shell/key-bindings.zsh \
38 --replace " perl -ne " " ${perl}/bin/perl -ne "
39 substituteInPlace shell/key-bindings.bash \
40 --replace " perl -n " " ${perl}/bin/perl -n "
44 mkdir -p $out/share/fish/{vendor_functions.d,vendor_conf.d}
45 cp shell/key-bindings.fish $out/share/fish/vendor_functions.d/fzf_key_bindings.fish
46 cp ${fishHook} $out/share/fish/vendor_conf.d/load-fzf-key-bindings.fish
50 cp bin/fzf-tmux $out/bin
52 mkdir -p $man/share/man
53 cp -r man/man1 $man/share/man
55 mkdir -p $out/share/vim-plugins/${pname}
56 cp -r plugin $out/share/vim-plugins/${pname}
58 cp -R shell $out/share/fzf
59 cat <<SCRIPT > $out/bin/fzf-share
61 # Run this script to find the fzf shared folder where all the shell
62 # integration scripts are living.
65 chmod +x $out/bin/fzf-share
69 homepage = "https://github.com/junegunn/fzf";
70 description = "A command-line fuzzy finder written in Go";
71 license = licenses.mit;
72 maintainers = with maintainers; [ Br1ght0ne ma27 zowoq ];
73 platforms = platforms.unix;
74 changelog = "https://github.com/junegunn/fzf/blob/${version}/CHANGELOG.md";