summary refs log tree commit diff
path: root/pkgs/tools/misc/dasht/default.nix
blob: 4ab9cfdd0e0fe90dc20748a48f17066dbaae7210 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ stdenv
, lib
, fetchFromGitHub
, makeWrapper
, installShellFiles
, coreutils
, gnused
, gnugrep
, sqlite
, wget
, w3m
, socat
, gawk
}:

stdenv.mkDerivation rec {
  pname   = "dasht";
  version = "2.4.0";

  src = fetchFromGitHub {
    owner  = "sunaku";
    repo   = pname;
    rev    = "v${version}";
    sha256 = "08wssmifxi7pnvn9gqrvpzpkc2qpkfbzbhxh0dk1gff2y2211qqk";
  };

  deps = lib.makeBinPath [
    coreutils
    gnused
    gnugrep
    sqlite
    wget
    w3m
    socat
    gawk
    (placeholder "out")
  ];

  nativeBuildInputs = [ makeWrapper installShellFiles ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp bin/* $out/bin/

    installManPage man/man1/*
    installShellCompletion --zsh etc/zsh/completions/*

    for i in $out/bin/*; do
      echo "Wrapping $i"
      wrapProgram $i --prefix PATH : ${deps};
    done;

    runHook postInstall
  '';

  meta = {
    description = "Search API docs offline, in terminal or browser";
    homepage    = "https://sunaku.github.io/dasht/man";
    license     = lib.licenses.isc;
    platforms   = lib.platforms.unix; #cannot test other
    maintainers = with lib.maintainers; [ matthiasbeyer ];
  };
}