Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4936,6 +4936,12 @@
githubId = 45168934;
name = "Louis Blin";
};
lucc = {
email = "lucc+nix@posteo.de";
github = "lucc";
githubId = 1104419;
name = "Lucas Hoffmann";
};
ldelelis = {
email = "ldelelis@est.frba.utn.edu.ar";
github = "ldelelis";
Expand Down
50 changes: 50 additions & 0 deletions pkgs/tools/misc/nvimpager/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ fetchFromGitHub
, pkgs
Comment thread
lucc marked this conversation as resolved.
Outdated
# Defaults to false until I find out how to provide /dev/tty inside the
# sandbox.
, doCheck ? false
Comment thread
lucc marked this conversation as resolved.
Outdated
}:

pkgs.stdenv.mkDerivation rec {
pname = "nvimpager";
version = "0.9";

src = fetchFromGitHub {
owner = "lucc";
repo = pname;
rev = "v${version}";
sha256 = "1xy5387szfw0bp8dr7d4z33wd4xva7q219rvz8gc0vvv1vsy73va";
};

buildInputs = with pkgs; [
ncurses # for tput
neovim

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if I use a custom neovim ? maybe it should just be wrapped so that using a different neovim doesn't trigger a rebuild though I would think it's a pretty small package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I don't understand the question because I know to little about nix. I assume that this will use pkgs.nvimpager so if you use an overlay I think it should use your overlayed neovim (unless I understand overlays wrongly).

Or are you asking why I did not put nvimpager into the argument set of the package? If so: no reason, just ignorance to the benifits. (please enlighten me :)

What should be wrapped how?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's necessary: we don't even compile something here so rebuilds are cheap.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It causes a rebuild because the full path to neovim is hard coded into the shell script (the shell script accepts $NVIM to override the neovim executable at runtime and I set the full path in preBuild hook. I could also leave the default value at "nvim" and add the neovim derivation to the buildInputs)

procps # for nvim_get_proc() which uses ps(1)
pandoc
Comment thread
lucc marked this conversation as resolved.
Outdated
];

makeFlags = [ "PREFIX=$(out)" ];
buildFlags = [ "nvimpager.configured" ];
preBuild = ''
substituteInPlace nvimpager \
--replace '/usr/bin/env bash' '${pkgs.bash}/bin/bash' \
Comment thread
lucc marked this conversation as resolved.
Outdated
--replace ':-nvim' ':-${pkgs.neovim}/bin/nvim'
'';

inherit doCheck;
checkInputs = with pkgs; [ lua51Packages.busted ];
checkPhase = "busted --lpath './?.lua' test";

meta = with pkgs.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 = with maintainers; [ lucc ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6155,6 +6155,8 @@ in

nssmdns = callPackage ../tools/networking/nss-mdns { };

nvimpgaer = callPackage ../tools/misc/nvimpager { };
Comment thread
lucc marked this conversation as resolved.
Outdated

nwdiag = with python3Packages; toPythonApplication nwdiag;

nxdomain = python3.pkgs.callPackage ../tools/networking/nxdomain { };
Expand Down