2023-08-22 04:31:06 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2024-03-23 19:13:02 +01:00
|
|
|
, fetchpatch
|
2023-08-22 04:31:06 +02:00
|
|
|
, 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=";
|
|
|
|
};
|
|
|
|
|
2024-03-23 19:13:02 +01:00
|
|
|
patches = [
|
|
|
|
# Adds missing function declarations required by newer versions of clang.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/gabrielzschmitz/Tomato.C/commit/ad6d4c385ae39d655a716850653cd92431c1f31e.patch";
|
|
|
|
hash = "sha256-3ormv59Ce4rOmeyL30QET3CCUIOrRYMquub+eIQsMW8=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-08-22 04:31:06 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
2024-03-23 19:13:02 +01:00
|
|
|
--replace-fail "sudo " ""
|
|
|
|
# Need to define _ISOC99_SOURCE to use `snprintf` on Darwin
|
|
|
|
substituteInPlace config.mk \
|
|
|
|
--replace-fail -D_POSIX_C_SOURCE -D_ISOC99_SOURCE
|
2023-08-22 04:31:06 +02:00
|
|
|
substituteInPlace notify.c \
|
2024-03-23 19:13:02 +01:00
|
|
|
--replace-fail "/usr/local" "${placeholder "out"}"
|
2023-08-22 04:31:06 +02:00
|
|
|
substituteInPlace util.c \
|
2024-03-23 19:13:02 +01:00
|
|
|
--replace-fail "/usr/local" "${placeholder "out"}"
|
2023-08-22 04:31:06 +02:00
|
|
|
substituteInPlace tomato.desktop \
|
2024-03-23 19:13:02 +01:00
|
|
|
--replace-fail "/usr/local" "${placeholder "out"}"
|
2023-08-22 04:31:06 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libnotify
|
|
|
|
mpv
|
|
|
|
ncurses
|
|
|
|
];
|
|
|
|
|
2024-03-23 19:13:02 +01:00
|
|
|
makeFlags = [
|
2023-08-22 04:31:06 +02:00
|
|
|
"PREFIX=${placeholder "out"}"
|
2024-03-23 19:13:02 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
2023-08-22 04:31:06 +02:00
|
|
|
"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;
|
|
|
|
};
|
|
|
|
})
|