1{ stdenv
2, lib
3, fetchFromGitHub
4, makeWrapper
5, installShellFiles
6, coreutils
7, gnused
8, gnugrep
9, sqlite
10, wget
11, w3m
12, socat
13, gawk
14}:
15
16stdenv.mkDerivation rec {
17 pname = "dasht";
18 version = "2.4.0";
19
20 src = fetchFromGitHub {
21 owner = "sunaku";
22 repo = pname;
23 rev = "v${version}";
24 sha256 = "08wssmifxi7pnvn9gqrvpzpkc2qpkfbzbhxh0dk1gff2y2211qqk";
25 };
26
27 deps = lib.makeBinPath [
28 coreutils
29 gnused
30 gnugrep
31 sqlite
32 wget
33 w3m
34 socat
35 gawk
36 (placeholder "out")
37 ];
38
39 nativeBuildInputs = [ makeWrapper installShellFiles ];
40
41 installPhase = ''
42 runHook preInstall
43
44 mkdir -p $out/bin
45 cp bin/* $out/bin/
46
47 installManPage man/man1/*
48 installShellCompletion --zsh etc/zsh/completions/*
49
50 for i in $out/bin/*; do
51 echo "Wrapping $i"
52 wrapProgram $i --prefix PATH : ${deps};
53 done;
54
55 runHook postInstall
56 '';
57
58 meta = {
59 description = "Search API docs offline, in terminal or browser";
60 homepage = "https://sunaku.github.io/dasht/man";
61 license = lib.licenses.isc;
62 platforms = lib.platforms.unix; #cannot test other
63 maintainers = with lib.maintainers; [ matthiasbeyer ];
64 };
65}