about summary refs log tree commit diff
path: root/pkgs/by-name/do/docfd/package.nix
blob: 41d4f3cbf543079486f9709ec6c72b7967942a69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ lib, ocamlPackages, fetchFromGitHub, python3, dune_3, makeWrapper, poppler_utils, fzf }:

ocamlPackages.buildDunePackage rec {
  pname = "docfd";
  version = "2.2.0";

  minimalOCamlVersion = "5.1";

  src = fetchFromGitHub {
    owner = "darrenldl";
    repo = "docfd";
    rev = version;
    hash = "sha256-v6V9+/Ra19Xy6nCLe/ODJ1uVBwNkQO4lKcxcr2pmxIY=";
  };

  nativeBuildInputs = [ python3 dune_3 makeWrapper ];
  buildInputs = with ocamlPackages; [ oseq spelll notty nottui lwd cmdliner domainslib digestif yojson eio_main containers-data timedesc ];

  postInstall = ''
  # docfd needs pdftotext from popler_utils to allow pdf search
  # also fzf for "docfd ?" usage
  wrapProgram $out/bin/docfd --prefix PATH : "${lib.makeBinPath [ poppler_utils fzf ]}"
  '';

  meta = with lib; {
    description = "TUI multiline fuzzy document finder";
    longDescription = ''
      TUI multiline fuzzy document finder.
      Think interactive grep for both text files and PDFs, but word/token based
      instead of regex and line based, so you can search across lines easily.
      Docfd aims to provide good UX via integration with common text editors
      and PDF viewers, so you can jump directly to a search result with a
      single key press.
    '';
    homepage = "https://github.com/darrenldl/docfd";
    license = licenses.mit;
    maintainers = with maintainers; [ chewblacka ];
    platforms = platforms.all;
    mainProgram = "docfd";
  };
}