{ pkgs, lib, fetchFromGitHub }:
with pkgs.python3Packages;

buildPythonPackage rec {
  pname = "polybar-now-playing";
  version = "c61658efeda178a842b03c558749169aa629f5a6";

  # nativeBuildInputs = with pkgs; [ setuptools ];
  propagatedBuildInputs = with pkgs; [ dbus-python ];

  src = fetchFromGitHub {
    owner = "d093w1z";
    repo = pname;
    rev = version;
    sha256 = "DM4cVOWZiEJtBbGcA7PCuX2ZQMbNOj3AQX795ABBvOs=";
  };

  meta = with lib; {
    description = "Script for polybar to display and control media(not only Spotify) using DBus. ";
    homepage = "https://github.com/d093w1z/polybar-now-playing";
    maintaners = [ maintainers.tailhook ];
  };

  preBuild = ''
    cat > setup.py << 'EOF'
    from setuptools import setup
    setup (
      name='polybar-now-playing',
      author='d093w1z',
      description='Script for polybar to display and control media(not only Spotify) using DBus. ',
      install_requires=['dbus-python'],
      scripts=['polybar-now-playing'],
    )
    EOF
  '';
}
