about summary refs log tree commit diff
path: root/pkgs/tools/misc/nvimpager
diff options
context:
space:
mode:
authorLucas Hoffmann <lucc@users.noreply.github.com>2020-12-22 10:11:02 +0100
committerGitHub <noreply@github.com>2020-12-22 10:11:02 +0100
commit4d0c6c645cfe8410cf7bee5b175906b481dd64c3 (patch)
treedb42dcd1925625dcb080791a26ae25a271d74769 /pkgs/tools/misc/nvimpager
parentca8343d1b9053aa963f64150b5d56ba6395a5db2 (diff)
nvimpager: init at 0.9 (#107057)
* nvimpager: init at 0.9

* nvimpager: fixup: doCheck can be overriden with `overrideAttrs`

* nvimpager: fixup: use patchShebangs instead of substituteInPlace

* nvimpager: fixup: move pandoc to nativeBuildInputs

* Fix typo

* nvimpager: fixup: run the tests in a pseudo tty

* nvimpager: fixup: make all dependencies overridable
Diffstat (limited to 'pkgs/tools/misc/nvimpager')
-rw-r--r--pkgs/tools/misc/nvimpager/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/tools/misc/nvimpager/default.nix b/pkgs/tools/misc/nvimpager/default.nix
new file mode 100644
index 0000000000000..2c10c9fbfbb57
--- /dev/null
+++ b/pkgs/tools/misc/nvimpager/default.nix
@@ -0,0 +1,47 @@
+{ fetchFromGitHub
+, stdenv
+, ncurses, neovim, procps
+, pandoc, lua51Packages, util-linux
+}:
+
+stdenv.mkDerivation rec {
+  pname = "nvimpager";
+  version = "0.9";
+
+  src = fetchFromGitHub {
+    owner = "lucc";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1xy5387szfw0bp8dr7d4z33wd4xva7q219rvz8gc0vvv1vsy73va";
+  };
+
+  buildInputs = [
+    ncurses # for tput
+    procps # for nvim_get_proc() which uses ps(1)
+  ];
+  nativeBuildInputs = [ pandoc ];
+
+  makeFlags = [ "PREFIX=$(out)" ];
+  buildFlags = [ "nvimpager.configured" ];
+  preBuild = ''
+    patchShebangs nvimpager
+    substituteInPlace nvimpager --replace ':-nvim' ':-${neovim}/bin/nvim'
+    '';
+
+  doCheck = true;
+  checkInputs = [ lua51Packages.busted util-linux neovim ];
+  checkPhase = ''script -c "busted --lpath './?.lua' test"'';
+
+  meta = with stdenv.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 ];
+  };
+}