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";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "0.13.0";
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lucc";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
sha256 = "sha256-Au9rRZMZfU4qHi/ng6JO8FnMpySKDbKzr75SBPY3QiA=";
|
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
|
2024-06-05 15:53:02 +00:00
|
|
|
substituteInPlace nvimpager --replace-fail ':-nvim' ':-${lib.getExe neovim}'
|
2020-12-25 13:55:36 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ lua51Packages.busted util-linux neovim ];
|
2024-06-05 15:53:02 +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-28 23:13:55 +00:00
|
|
|
'';
|
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 ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "nvimpager";
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
|
|
|
}
|