From 77b7de2262eae166f2781d4c994d0a60635b84da Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Mon, 16 Feb 2026 09:11:19 -0800 Subject: [PATCH 1/2] python3Packages.viaggiatreno-ha: init at 0.2.4 Viaggiatreno API wrapper for querying Trenitalia ViaggiaTreno API, used by the Home Assistant viaggiatreno integration. https://github.com/monga/viaggiatreno_ha https://pypi.org/project/viaggiatreno-ha --- .../viaggiatreno-ha/default.nix | 44 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 46 insertions(+) create mode 100644 pkgs/development/python-modules/viaggiatreno-ha/default.nix diff --git a/pkgs/development/python-modules/viaggiatreno-ha/default.nix b/pkgs/development/python-modules/viaggiatreno-ha/default.nix new file mode 100644 index 000000000000..110a99362d0b --- /dev/null +++ b/pkgs/development/python-modules/viaggiatreno-ha/default.nix @@ -0,0 +1,44 @@ +{ + lib, + aiohttp, + buildPythonPackage, + fetchFromGitHub, + pytestCheckHook, + setuptools, +}: + +buildPythonPackage rec { + pname = "viaggiatreno-ha"; + version = "0.2.4"; + pyproject = true; + + src = fetchFromGitHub { + owner = "monga"; + repo = "viaggiatreno_ha"; + tag = "v${version}"; + hash = "sha256-XmZVguuZK4pnAqINBWJbyAa5VesrQS6wP1jNPdWqhiQ="; + }; + + build-system = [ setuptools ]; + + dependencies = [ aiohttp ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + preCheck = '' + cd tests + ''; + + # Tests use aiohttp's AioHTTPTestCase which starts a local TCP server + __darwinAllowLocalNetworking = true; + + pythonImportsCheck = [ "viaggiatreno_ha" ]; + + meta = { + changelog = "https://github.com/monga/viaggiatreno_ha/releases/tag/${src.tag}"; + description = "Viaggiatreno API wrapper to use with Home Assistant"; + homepage = "https://github.com/monga/viaggiatreno_ha"; + license = lib.licenses.gpl3Plus; + maintainers = [ lib.maintainers.jamiemagee ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9a84b34e2e7a..98692ca6c1ca 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -20444,6 +20444,8 @@ self: super: with self; { vharfbuzz = callPackage ../development/python-modules/vharfbuzz { }; + viaggiatreno-ha = callPackage ../development/python-modules/viaggiatreno-ha { }; + victron-vrm = callPackage ../development/python-modules/victron-vrm { }; videocr = callPackage ../development/python-modules/videocr { }; From bc2be29de416f284280583c452688694fcf4345e Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Mon, 16 Feb 2026 09:11:26 -0800 Subject: [PATCH 2/2] home-assistant: regenerate component-packages.nix Resolves missing viaggiatreno_ha dependency for the viaggiatreno integration. --- pkgs/servers/home-assistant/component-packages.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index de8714897649..7d4680b7b588 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -6639,7 +6639,8 @@ ]; "viaggiatreno" = ps: with ps; [ - ]; # missing inputs: viaggiatreno_ha + viaggiatreno-ha + ]; "vicare" = ps: with ps; [ pyvicare