about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/oil-buku/default.nix
blob: 5f895179f1f4781d02336dd9ef3e539ae480898f (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
{ stdenvNoCC, lib, fetchFromGitHub, jq, gawk, peco, makeWrapper }:

stdenvNoCC.mkDerivation rec {
  pname = "oil-buku";
  version = "0.3.2";

  src = fetchFromGitHub {
    owner = "AndreiUlmeyda";
    repo = "oil";
    rev = version;
    sha256 = "12g0fd7h11hh94b2pyg3pqwbf8bc7gcnrnm1qqbf18s6z02b6ixr";
  };

  postPatch = ''
    substituteInPlace src/oil --replace \
      "LIBDIR=/usr/local/lib/oil" "LIBDIR=${placeholder "out"}/lib"

    substituteInPlace src/json-to-line.jq --replace \
      "/usr/bin/env -S jq" "${jq}/bin/jq"

    substituteInPlace src/format-columns.awk --replace \
      "/usr/bin/env -S awk" "${gawk}/bin/awk"
  '';

  makeFlags = [
    "BINDIR=${placeholder "out"}/bin"
    "LIBDIR=${placeholder "out"}/lib"
  ];

  nativeBuildInputs = [ makeWrapper ];

  postFixup = ''
    wrapProgram $out/bin/oil \
        --prefix PATH : ${lib.makeBinPath [ peco ]}
  '';

  meta = with lib; {
    description = "Search-as-you-type cli frontend for the buku bookmarks manager using peco";
    homepage = "https://github.com/AndreiUlmeyda/oil";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ atila ];
    mainProgram = "oil";
    platforms = platforms.unix;
  };
}