nixpkgs/pkgs/applications/version-management/tig/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

58 lines
1.8 KiB
Nix

{ lib, stdenv, fetchFromGitHub, ncurses, asciidoc, xmlto, docbook_xsl, docbook_xml_dtd_45
, readline, makeWrapper, git, libiconv, autoreconfHook, findXMLCatalogs, pkg-config
}:
stdenv.mkDerivation rec {
pname = "tig";
version = "2.5.10";
src = fetchFromGitHub {
owner = "jonas";
repo = pname;
rev = "${pname}-${version}";
sha256 = "sha256-WTrw7WaSqC2fp76fPvfogWTibev0Hg0LW2x4umc3+1Q=";
};
nativeBuildInputs = [ makeWrapper autoreconfHook asciidoc xmlto docbook_xsl docbook_xml_dtd_45 findXMLCatalogs pkg-config ];
autoreconfFlags = [ "-I" "tools" "-v" ];
buildInputs = [ ncurses readline git ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
# those files are inherently impure, we'll handle the corresponding dependencies.
postPatch = ''
rm 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 implementation 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 lib; {
homepage = "https://jonas.github.io/tig/";
description = "Text-mode interface for git";
maintainers = with maintainers; [ bjornfor domenkozar qknight globin ma27 ];
license = licenses.gpl2Plus;
platforms = platforms.unix;
mainProgram = "tig";
};
}