1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-03 19:15:39 +00:00
nixpkgs/pkgs/tools/misc/nvimpager/default.nix
Lucas Hoffmann d56b1567ec
nvimpager: 0.9 -> 0.10 (#126027)
* nvimpager: 0.9 -> 0.10

Patch the makefile as it assumes it is run in a git checkout and not
from an extracted tarball.

* fixup: add comment about new subsitute command in preBuild

* fixup: Fix definition of checkPhase
2021-06-07 23:27:37 +02:00

55 lines
1.5 KiB
Nix

{ fetchFromGitHub
, lib, stdenv
, ncurses, neovim, procps
, scdoc, lua51Packages, util-linux
}:
stdenv.mkDerivation rec {
pname = "nvimpager";
version = "0.10";
src = fetchFromGitHub {
owner = "lucc";
repo = pname;
rev = "v${version}";
sha256 = "sha256-okYnPwuxU/syxcKIMUBc25r791D6Bug2w2axH4vvmAY=";
};
buildInputs = [
ncurses # for tput
procps # for nvim_get_proc() which uses ps(1)
];
nativeBuildInputs = [ scdoc ];
makeFlags = [ "PREFIX=$(out)" ];
buildFlags = [ "nvimpager.configured" "nvimpager.1" ];
preBuild = ''
patchShebangs nvimpager
substituteInPlace nvimpager --replace ':-nvim' ':-${neovim}/bin/nvim'
# remove git command from makefile as we run from a tarball
# replace with actual timestamp of the commit
substituteInPlace makefile --replace '$(shell git log -1 --no-show-signature --pretty="%ct")' 1623019602
'';
doCheck = true;
checkInputs = [ lua51Packages.busted util-linux neovim ];
checkPhase = ''
runHook preCheck
script -c "busted --lpath './?.lua' test"
runHook postCheck
'';
meta = with lib; {
description = "Use neovim as pager";
longDescription = ''
Use neovim as a pager to view manpages, diffs, etc with nvim's syntax
highlighting. Includes a cat mode to print highlighted files to stdout
and a ansi esc mode to highlight ansi escape sequences in neovim.
'';
homepage = "https://github.com/lucc/nvimpager";
license = licenses.bsd2;
platforms = platforms.unix;
maintainers = [ maintainers.lucc ];
};
}