2020-12-22 09:11:02 +00:00
|
|
|
{ fetchFromGitHub
|
2021-01-11 07:54:33 +00:00
|
|
|
, lib, stdenv
|
2020-12-22 09:11:02 +00:00
|
|
|
, ncurses, neovim, procps
|
2021-06-07 21:27:37 +00:00
|
|
|
, scdoc, lua51Packages, util-linux
|
2020-12-22 09:11:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nvimpager";
|
2024-05-20 21:50:54 +00:00
|
|
|
version = "0.13.0";
|
2020-12-22 09:11:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lucc";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-05-20 21:50:54 +00:00
|
|
|
sha256 = "sha256-Au9rRZMZfU4qHi/ng6JO8FnMpySKDbKzr75SBPY3QiA=";
|
2020-12-22 09:11:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
ncurses # for tput
|
|
|
|
procps # for nvim_get_proc() which uses ps(1)
|
|
|
|
];
|
2021-06-07 21:27:37 +00:00
|
|
|
nativeBuildInputs = [ scdoc ];
|
2020-12-22 09:11:02 +00:00
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
2021-06-07 21:27:37 +00:00
|
|
|
buildFlags = [ "nvimpager.configured" "nvimpager.1" ];
|
2020-12-22 09:11:02 +00:00
|
|
|
preBuild = ''
|
|
|
|
patchShebangs nvimpager
|
2024-05-20 21:50:54 +00:00
|
|
|
substituteInPlace nvimpager --replace-fail ':-nvim' ':-${lib.getExe neovim}'
|
2020-12-22 09:11:02 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [ lua51Packages.busted util-linux neovim ];
|
2024-05-20 21:50:54 +00:00
|
|
|
# filter out one test that fails in the sandbox of nix or with neovim v0.10
|
|
|
|
# or on macOS
|
|
|
|
preCheck = ''
|
|
|
|
checkFlagsArray+=('BUSTED=busted --output TAP --exclude-tags=${"nix,v10" + lib.optionalString stdenv.isDarwin ",mac"}')
|
2021-06-07 21:27:37 +00:00
|
|
|
'';
|
2020-12-22 09:11:02 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-12-22 09:11:02 +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 ];
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "nvimpager";
|
2020-12-22 09:11:02 +00:00
|
|
|
};
|
|
|
|
}
|