nixpkgs/pkgs/tools/misc/nvimpager/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.5 KiB
Nix
Raw Normal View History

{ fetchFromGitHub
, lib, stdenv
, ncurses, neovim, procps
, scdoc, lua51Packages, util-linux
}:
stdenv.mkDerivation rec {
pname = "nvimpager";
2024-05-20 21:50:54 +00:00
version = "0.13.0";
src = fetchFromGitHub {
owner = "lucc";
repo = pname;
rev = "v${version}";
2024-05-20 21:50:54 +00:00
sha256 = "sha256-Au9rRZMZfU4qHi/ng6JO8FnMpySKDbKzr75SBPY3QiA=";
};
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
2024-05-20 21:50:54 +00:00
substituteInPlace nvimpager --replace-fail ':-nvim' ':-${lib.getExe neovim}'
'';
doCheck = true;
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"}')
'';
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 ];
2023-11-27 01:17:53 +00:00
mainProgram = "nvimpager";
};
}