about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/tomato-c/default.nix
blob: 9f87712399f2be9a88cdaa43eb05047e18fca9cc (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
61
62
63
64
65
66
67
{ lib
, stdenv
, fetchFromGitHub
, libnotify
, makeWrapper
, mpv
, ncurses
, pkg-config
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "tomato-c";
  version = "unstable-2023-08-21";

  src = fetchFromGitHub {
    owner = "gabrielzschmitz";
    repo = "Tomato.C";
    rev = "6e43e85aa15f3d96811311a3950eba8ce9715634";
    hash = "sha256-RpKkQ7xhM2XqfZdXra0ju0cTBL3Al9NMVQ/oleFydDs=";
  };

  postPatch = ''
    substituteInPlace Makefile \
      --replace "sudo " ""
    substituteInPlace notify.c \
      --replace "/usr/local" "${placeholder "out"}"
    substituteInPlace util.c \
      --replace "/usr/local" "${placeholder "out"}"
    substituteInPlace tomato.desktop \
      --replace "/usr/local" "${placeholder "out"}"
  '';

  nativeBuildInputs = [
    makeWrapper
    pkg-config
  ];

  buildInputs = [
    libnotify
    mpv
    ncurses
  ];

  installFlags = [
    "PREFIX=${placeholder "out"}"
    "CPPFLAGS=$NIX_CFLAGS_COMPILE"
    "LDFLAGS=$NIX_LDFLAGS"
  ];

  postFixup = ''
    for file in $out/bin/*; do
      wrapProgram $file \
        --prefix PATH : ${lib.makeBinPath [ libnotify mpv ]}
    done
  '';

  strictDeps = true;

  meta = {
    homepage = "https://github.com/gabrielzschmitz/Tomato.C";
    description = " A pomodoro timer written in pure C";
    license = with lib.licenses; [ gpl3Plus ];
    maintainers = with lib.maintainers; [ AndersonTorres ];
    mainProgram = "tomato";
    platforms = lib.platforms.unix;
  };
})