3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/version-management/git-and-tools/tig/default.nix
Michael Weiss e9c36545a7
tig: Don't install the broken ZSH completion
There are some Nixpkgs specific issues that we could fix but due to
changes in Git it currently isn't possible to source git-completion.bash
from ZSH (at least not how tig-completion.bash expects it).
Upstream issue: https://github.com/jonas/tig/issues/940

For the meantime it seems best to simply not install it anymore so that
the fallback implementation from ZSH can be used (more inaccurate as the
git-log completion is reused but it is helpful to complete remotes,
branches, tags, etc. and doesn't emit an error to the console).
2020-07-31 20:57:35 +02:00

57 lines
1.8 KiB
Nix

{ stdenv, fetchFromGitHub, ncurses, asciidoc, xmlto, docbook_xsl, docbook_xml_dtd_45
, readline, makeWrapper, git, libiconv, autoreconfHook, findXMLCatalogs, pkgconfig
}:
stdenv.mkDerivation rec {
pname = "tig";
version = "2.5.1";
src = fetchFromGitHub {
owner = "jonas";
repo = pname;
rev = "${pname}-${version}";
sha256 = "0wxcbfqsk8p84zizy6lf3gp5j122wrf8c7xlipki6nhcfhksn33b";
};
nativeBuildInputs = [ makeWrapper autoreconfHook asciidoc xmlto docbook_xsl docbook_xml_dtd_45 findXMLCatalogs pkgconfig ];
autoreconfFlags = "-I tools -v";
buildInputs = [ ncurses readline git ]
++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ];
# those files are inherently impure, we'll handle the corresponding dependencies.
postPatch = ''
rm -f contrib/config.make-*
'';
enableParallelBuilding = true;
installPhase = ''
make install
make install-doc
# fixes tig-completion __git-complete dependency
sed -i '1s;^;source ${git}/share/bash-completion/completions/git\n;' contrib/tig-completion.bash
install -D contrib/tig-completion.bash $out/share/bash-completion/completions/tig
cp contrib/vim.tigrc $out/etc/
# Note: Until https://github.com/jonas/tig/issues/940 is resolved it is best
# not to install the ZSH completion so that the fallback implemenation from
# ZSH can be used (Completion/Unix/Command/_git: "_tig () { _git-log }"):
#install -D contrib/tig-completion.zsh $out/share/zsh/site-functions/_tig
wrapProgram $out/bin/tig \
--prefix PATH ':' "${git}/bin"
'';
meta = with stdenv.lib; {
homepage = "https://jonas.github.io/tig/";
description = "Text-mode interface for git";
maintainers = with maintainers; [ bjornfor domenkozar qknight globin ];
license = licenses.gpl2;
platforms = platforms.unix;
};
}