3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/version-management/git-and-tools/tig/default.nix
Maximilian Bosch 4bf1a7d975
tig: fix zsh completion
The ZSH completion script of `tig` basically imports the bash completion
script and uses it as completion approach. Unfortunately the script
takes several assumptions about the directory structure using
`$funcsourcetrace`[1] that don't apply on NixOS.

The easiest workaround is t opatch the completion script and import the
bash completion script from `$out`.

[1] http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#index-funcsourcetrace
2018-09-23 19:36:22 +02:00

54 lines
1.6 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.4.1";
name = "${pname}-${version}";
src = fetchFromGitHub {
owner = "jonas";
repo = pname;
rev = name;
sha256 = "0i26yfn2vjgsg1kdvhhv55jwzds7ih7cnad1xqvilqm83zh47ksd";
};
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
substituteInPlace contrib/tig-completion.zsh \
--replace 'e=$(dirname ''${funcsourcetrace[1]%:*})/tig-completion.bash' "e=$out/etc/bash_completion.d/tig-completion.bash"
install -D contrib/tig-completion.bash $out/etc/bash_completion.d/tig-completion.bash
install -D contrib/tig-completion.zsh $out/share/zsh/site-functions/_tig
cp contrib/vim.tigrc $out/etc/
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; [ garbas bjornfor domenkozar qknight ];
license = licenses.gpl2;
platforms = platforms.unix;
};
}