{
  buildHomeAssistantComponent,
  fetchFromGitHub,
  python3Packages,
  ...
}:
buildHomeAssistantComponent rec {
  owner = "moralmunky";
  domain = "mail_and_packages";
  version = "0.4.3-b20";

  src = fetchFromGitHub {
    owner = owner;
    repo = "Home-Assistant-Mail-And-Packages";
    rev = version;
    hash = "sha256-ueZcfhspi+aViiZ//AJuExeB1Dk/DUeGXYogrXqiy3Q=";
  };

  propagatedBuildInputs = with python3Packages; [
    beautifulsoup4
    dateparser
    pillow
  ];

  postPatch = ''
    substituteInPlace custom_components/mail_and_packages/const.py \
      --replace-fail 'DEFAULT_PATH = "custom_components/mail_and_packages/images/"' \
                    'DEFAULT_PATH = "/var/lib/homeassistant/images/"' \
      --replace-fail 'DEFAULT_STORAGE = "custom_components/mail_and_packages/images/"' \
                    'DEFAULT_STORAGE = "/var/lib/homeassistant/images/"' \
      --replace-fail 'DEFAULT_CUSTOM_IMG_FILE = "custom_components/mail_and_packages/images/mail_none.gif"' \
                    'DEFAULT_CUSTOM_IMG_FILE = "/var/lib/homeassistant/images/mail_none.gif"'

    substituteInPlace custom_components/mail_and_packages/helpers.py \
      --replace-fail 'return "custom_components/mail_and_packages/images/"' \
                    'return "/var/lib/homeassistant/images/"'
  '';

  meta = {
    changelog = "https://github.com/moralmunky/Home-Assistant-Mail-And-Packages/releases/tag/${version}";
    description = "The Mail and Packages integration creates sensors for supported shippers to show a snapshot of mail and packages that are scheduled to be delivered the current day.";
    homepage = "https://github.com/moralmunky/Home-Assistant-Mail-And-Packages";
    maintainers = [ ];
  };
}
