58 lines
2.0 KiB
Nix
58 lines
2.0 KiB
Nix
{
|
|
lib,
|
|
namespace,
|
|
pkgs,
|
|
buildHomeAssistantComponent,
|
|
home-assistant,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib.trivial) importJSON;
|
|
inherit (lib.${namespace}) selectVariant mkAllSources;
|
|
|
|
versionSpec = importJSON ./version.json;
|
|
selected = selectVariant versionSpec null null;
|
|
sources = mkAllSources pkgs selected;
|
|
src-meta = selected.sources.mail_and_packages;
|
|
version = if src-meta ? tag then src-meta.tag else src-meta.rev;
|
|
in
|
|
buildHomeAssistantComponent {
|
|
owner = src-meta.owner;
|
|
domain = "mail_and_packages";
|
|
inherit version;
|
|
|
|
src = sources.mail_and_packages;
|
|
|
|
nativeBuildInputs = with home-assistant.python.pkgs; [
|
|
aioimaplib
|
|
beautifulsoup4
|
|
dateparser
|
|
pillow
|
|
];
|
|
|
|
propagatedBuildInputs = with home-assistant.python.pkgs; [
|
|
aioimaplib
|
|
];
|
|
|
|
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 = [ ];
|
|
};
|
|
}
|