1{
2 lib,
3 stdenvNoCC,
4 fetchFromGitHub,
5 makeWrapper,
6
7 fzf,
8 ripgrep,
9 gawk,
10 w3m,
11 coreutils,
12 parallel,
13
14 nix-update-script,
15}:
16stdenvNoCC.mkDerivation (finalAttrs: {
17 pname = "wikiman";
18 version = "2.14.1";
19
20 src = fetchFromGitHub {
21 owner = "filiparag";
22 repo = "wikiman";
23 tag = finalAttrs.version;
24 hash = "sha256-EvYMUHKFJhSFyoW85EEzI7q5OMGGe9c+A2JlkAoxt3o=";
25 };
26
27 patches = [ ./fix-paths.patch ];
28
29 nativeBuildInputs = [ makeWrapper ];
30
31 makeFlags = [ "prefix=${placeholder "out"}" ];
32
33 postInstall = ''
34 mv $out/usr/* $out
35 rmdir $out/usr
36 '';
37
38 postFixup =
39 let
40 runtimeDependencies = [
41 fzf
42 ripgrep
43 gawk
44 w3m
45 coreutils
46 parallel
47 ];
48 in
49 ''
50 wrapProgram $out/bin/wikiman \
51 --prefix PATH : "${lib.makeBinPath runtimeDependencies}":$out/bin \
52 --set "conf_sys_usr" "$out"
53 '';
54
55 # Couldn't do a versionCheckHook since the script fails when no sources are found.
56 # Even when just printing the version. Yeah.
57
58 passthru.updateScript = nix-update-script { };
59
60 meta = {
61 description = "Offline search engine for manual pages, Arch Wiki, Gentoo Wiki and other documentation";
62 homepage = "https://github.com/filiparag/wikiman";
63 license = with lib.licenses; [ mit ];
64 platforms = lib.platforms.unix;
65 maintainers = with lib.maintainers; [ pluiedev ];
66 mainProgram = "wikiman";
67 };
68})