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

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

  src = fetchFromGitHub {
    owner = "mfep";
    repo = "exercise-timer";
    rev = "v${version}";
    hash = "sha256-6MBSUYFZ8nMZX7acam8T0uJWb9E2/L9vnKzJq14p4BY=";
  };

  cargoDeps = rustPlatform.fetchCargoTarball {
    inherit src;
    name = "${pname}-${version}";
    hash = "sha256-mXHw87IUMq1qXQSTavI/ReKUyB0rNMXYld8vND38C30=";
  };

  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;
  };
}
