{
  lib,
  stdenv,
  fetchFromGitHub,
  cargo,
  meson,
  ninja,
  pkg-config,
  rustPlatform,
  rustc,
  wrapGAppsHook4,
  cairo,
  gdk-pixbuf,
  glib,
  gtk4,
  libadwaita,
  pango,
  darwin,
  alsa-lib,
  pulseaudio,
  pipewire,
  desktop-file-utils,
}:

stdenv.mkDerivation rec {
  pname = "exercise-timer";
  version = "1.8.5";

  src = fetchFromGitHub {
    owner = "mfep";
    repo = "exercise-timer";
    rev = "v${version}";
    hash = "sha256-YZYAhG8xpXM1m1LrXgwxo3JF74QjOmbnuSbo4SYPBmg=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit src;
    name = "${pname}-${version}";
    hash = "sha256-JObzeiQHEGIDjOung3o8dpaXVcOoJS2v1hyrcS1fqcI=";
  };

  nativeBuildInputs = [
    cargo
    meson
    ninja
    pkg-config
    rustPlatform.bindgenHook
    rustPlatform.cargoSetupHook
    rustc
    wrapGAppsHook4
    desktop-file-utils
  ];

  buildInputs = [
    cairo
    gdk-pixbuf
    glib
    gtk4
    libadwaita
    pango
  ]
  ++ lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.CoreAudio
  ]
  ++ lib.optionals stdenv.isLinux [
    alsa-lib
    pulseaudio
    pipewire
  ];

  meta = {
    description = "Timer app for high intensity interval training";
    homepage = "https://github.com/mfep/exercise-timer";
    changelog = "https://github.com/mfep/exercise-timer/blob/${src.rev}/CHANGELOG.md";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ CaptainJawZ ];
    mainProgram = "hiit";
    platforms = lib.platforms.all;
  };
}
