about summary refs log tree commit diff
path: root/pkgs/tools/misc/flitter/default.nix
blob: 5df3d168a9b0ab579cc148f321d0e1e8ced156b7 (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
{ lib
, ocamlPackages
, fetchFromGitHub
, makeWrapper
, python3
}:

ocamlPackages.buildDunePackage {
  pname = "flitter";
  # request to tag releases: https://github.com/alexozer/flitter/issues/34
  version = "unstable-2020-10-05";

  duneVersion = "3";

  src = fetchFromGitHub {
    owner = "alexozer";
    repo = "flitter";
    rev = "666c5483bc93efa6d01e0b7a927461269f8e14de";
    sha256 = "1k3m7bjq5yrrq7vhnbdykni65dsqhq6knnv9wvwq3svb3n07z4w3";
  };

  # compatibility with core >= 0.15
  patches = [ ./flitter.patch ];

  # https://github.com/alexozer/flitter/issues/28
  postPatch = ''
    for f in src/*.ml; do
      substituteInPlace "$f" \
        --replace 'Unix.gettimeofday' 'Caml_unix.gettimeofday' \
        --replace 'Core_kernel' 'Core' \
        --replace 'sexp_option' 'option[@sexp.option]' \
        --replace 'sexp_list' 'list[@sexp.list]'
    done
  '';

  nativeBuildInputs = [
    makeWrapper
  ];

  buildInputs = with ocamlPackages; [
    core_unix
    lwt_ppx
    sexp_pretty
    color
    notty
  ];

  postInstall = ''
    wrapProgram $out/bin/flitter \
      --prefix PATH : "${python3.withPackages (pp: [ pp.pynput ])}/bin"
  '';

  meta = with lib; {
    description = "A Livesplit-inspired speedrunning split timer for Linux/macOS terminal";
    license = licenses.mit;
    maintainers = with maintainers; [ fgaz ];
    homepage = "https://github.com/alexozer/flitter";
    platforms = platforms.unix;
  };
}