2020-12-25 13:55:36 +00:00
|
|
|
{ fetchFromGitHub
|
2021-01-15 22:18:51 +00:00
|
|
|
, lib, stdenv
|
2020-12-25 13:55:36 +00:00
|
|
|
, ncurses, neovim, procps
|
2021-06-28 23:13:55 +00:00
|
|
|
, scdoc, lua51Packages, util-linux
|
2020-12-25 13:55:36 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nvimpager";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "0.10";
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lucc";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "sha256-okYnPwuxU/syxcKIMUBc25r791D6Bug2w2axH4vvmAY=";
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
ncurses # for tput
|
|
|
|
procps # for nvim_get_proc() which uses ps(1)
|
|
|
|
];
|
2021-06-28 23:13:55 +00:00
|
|
|
nativeBuildInputs = [ scdoc ];
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
2021-06-28 23:13:55 +00:00
|
|
|
buildFlags = [ "nvimpager.configured" "nvimpager.1" ];
|
2020-12-25 13:55:36 +00:00
|
|
|
preBuild = ''
|
|
|
|
patchShebangs nvimpager
|
|
|
|
substituteInPlace nvimpager --replace ':-nvim' ':-${neovim}/bin/nvim'
|
2021-06-28 23:13:55 +00:00
|
|
|
# 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
|
2020-12-25 13:55:36 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkInputs = [ lua51Packages.busted util-linux neovim ];
|
2021-06-28 23:13:55 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
script -c "busted --lpath './?.lua' test"
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2020-12-25 13:55:36 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-12-25 13:55:36 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|