at 17.09-beta 59 lines 1.7 kB view raw
1{ stdenv, lib, ncurses, buildGoPackage, fetchFromGitHub, writeText }: 2 3buildGoPackage rec { 4 name = "fzf-${version}"; 5 version = "0.17.0"; 6 rev = "${version}"; 7 8 goPackagePath = "github.com/junegunn/fzf"; 9 10 src = fetchFromGitHub { 11 inherit rev; 12 owner = "junegunn"; 13 repo = "fzf"; 14 sha256 = "0cj9vvrsrxj7752fxww1bkflz9rap0n4hhwd6shs0qbss1awwqk9"; 15 }; 16 17 outputs = [ "bin" "out" "man" ]; 18 19 fishHook = writeText "load-fzf-keybindings.fish" "fzf_key_bindings"; 20 21 buildInputs = [ ncurses ]; 22 23 goDeps = ./deps.nix; 24 25 patchPhase = '' 26 sed -i -e "s|expand('<sfile>:h:h').'/bin/fzf'|'$bin/bin/fzf'|" plugin/fzf.vim 27 sed -i -e "s|expand('<sfile>:h:h').'/bin/fzf-tmux'|'$bin/bin/fzf-tmux'|" plugin/fzf.vim 28 ''; 29 30 preInstall = '' 31 mkdir -p $bin/share/fish/vendor_functions.d $bin/share/fish/vendor_conf.d 32 cp $src/shell/key-bindings.fish $bin/share/fish/vendor_functions.d/fzf_key_bindings.fish 33 cp ${fishHook} $bin/share/fish/vendor_conf.d/load-fzf-key-bindings.fish 34 ''; 35 36 postInstall = '' 37 cp $src/bin/fzf-tmux $bin/bin 38 mkdir -p $man/share/man 39 cp -r $src/man/man1 $man/share/man 40 mkdir -p $out/share/vim-plugins 41 ln -s $out/share/go/src/github.com/junegunn/fzf $out/share/vim-plugins/${name} 42 43 cp -R $src/shell $bin/share/fzf 44 cat <<SCRIPT > $bin/bin/fzf-share 45 #!/bin/sh 46 # Run this script to find the fzf shared folder where all the shell 47 # integration scripts are living. 48 echo $bin/share/fzf 49 SCRIPT 50 chmod +x $bin/bin/fzf-share 51 ''; 52 53 meta = with stdenv.lib; { 54 homepage = https://github.com/junegunn/fzf; 55 description = "A command-line fuzzy finder written in Go"; 56 license = licenses.mit; 57 platforms = platforms.unix; 58 }; 59}