Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / shells / fzf-git-sh / default.nix
blob598c2d0eb0b2eb7a6d20792b105007b2d50c2e2d
1 { stdenv
2 , lib
3 , bash
4 , bat
5 , coreutils
6 , fetchFromGitHub
7 , findutils
8 , fzf
9 , gawk
10 , git
11 , gnugrep
12 , gnused
13 , tmux
14 , util-linux
15 , xdg-utils
18 stdenv.mkDerivation rec {
19   pname = "fzf-git-sh";
20   version = "unstable-2022-09-30";
22   src = fetchFromGitHub {
23     owner = "junegunn";
24     repo = "fzf-git.sh";
25     rev = "9190e1bf7273d85f435fa759a5c3b20e588e9f7e";
26     sha256 = "sha256-2CGjk1oTXip+eAJMuOk/X3e2KTwfwzcKTcGToA2xPd4=";
27   };
29   dontBuild = true;
31   postPatch = ''
32     sed -i \
33       -e "s,\bawk\b,${gawk}/bin/awk," \
34       -e "s,\bbash\b,${bash}/bin/bash," \
35       -e "s,\bbat\b,${bat}/bin/bat," \
36       -e "s,\bcat\b,${coreutils}/bin/cat," \
37       -e "s,\bcut\b,${coreutils}/bin/cut," \
38       -e "s,\bhead\b,${coreutils}/bin/head," \
39       -e "s,\buniq\b,${coreutils}/bin/uniq," \
40       -e "s,\bcolumn\b,${util-linux}/bin/column," \
41       -e "s,\bfzf-tmux\b,${fzf}/bin/fzf-tmux," \
42       -e "/display-message/!s,\bgit\b,${git}/bin/git,g" \
43       -e "s,\bgrep\b,${gnugrep}/bin/grep," \
44       -e "s,\bsed\b,${gnused}/bin/sed," \
45       -e "/fzf-tmux/!s,\btmux\b,${tmux}/bin/tmux," \
46       -e "s,\bxargs\b,${findutils}/bin/xargs," \
47       -e "s,\bxdg-open\b,${xdg-utils}/bin/xdg-open," \
48       -e "s,__fzf_git=.*BASH_SOURCE.*,__fzf_git=$out/share/${pname}/fzf-git.sh," \
49       -e "/__fzf_git=.*readlink.*/d" \
50       fzf-git.sh
51   '';
53   installPhase = ''
54     install -D fzf-git.sh $out/share/${pname}/fzf-git.sh
55   '';
57   meta = with lib; {
58     homepage = "https://github.com/junegunn/fzf-git.sh";
59     description = "Bash and zsh key bindings for Git objects, powered by fzf";
60     license = licenses.mit;
61     maintainers = with maintainers; [ deejayem ];
62     platforms = platforms.all;
63   };