summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/wi/wikiman/package.nix
blob: 4f7742b6e11214e00d34b7e4c455982bb48e10ab (plain)
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
66
67
68
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  makeWrapper,

  fzf,
  ripgrep,
  gawk,
  w3m,
  coreutils,
  parallel,

  nix-update-script,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "wikiman";
  version = "2.14.1";

  src = fetchFromGitHub {
    owner = "filiparag";
    repo = "wikiman";
    tag = finalAttrs.version;
    hash = "sha256-EvYMUHKFJhSFyoW85EEzI7q5OMGGe9c+A2JlkAoxt3o=";
  };

  patches = [ ./fix-paths.patch ];

  nativeBuildInputs = [ makeWrapper ];

  makeFlags = [ "prefix=${placeholder "out"}" ];

  postInstall = ''
    mv $out/usr/* $out
    rmdir $out/usr
  '';

  postFixup =
    let
      runtimeDependencies = [
        fzf
        ripgrep
        gawk
        w3m
        coreutils
        parallel
      ];
    in
    ''
      wrapProgram $out/bin/wikiman \
        --prefix PATH : "${lib.makeBinPath runtimeDependencies}":$out/bin \
        --set "conf_sys_usr" "$out"
    '';

  # Couldn't do a versionCheckHook since the script fails when no sources are found.
  # Even when just printing the version. Yeah.

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Offline search engine for manual pages, Arch Wiki, Gentoo Wiki and other documentation";
    homepage = "https://github.com/filiparag/wikiman";
    license = lib.licenses.mit;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ pluiedev ];
    mainProgram = "wikiman";
  };
})