2021-03-09 03:18:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2022-01-19 23:45:15 +00:00
|
|
|
, callPackage
|
2021-03-09 03:18:52 +00:00
|
|
|
, fetchFromGitHub
|
2023-03-04 12:14:45 +00:00
|
|
|
, fetchPypi
|
2023-07-15 17:15:38 +00:00
|
|
|
, python311
|
2021-12-19 01:06:50 +00:00
|
|
|
, substituteAll
|
2022-12-02 08:20:57 +00:00
|
|
|
, ffmpeg-headless
|
2021-05-20 23:08:51 +00:00
|
|
|
, inetutils
|
2021-03-09 03:18:52 +00:00
|
|
|
, nixosTests
|
2022-12-28 21:21:41 +00:00
|
|
|
, home-assistant
|
|
|
|
, testers
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Look up dependencies of specified components in component-packages.nix
|
|
|
|
, extraComponents ? [ ]
|
|
|
|
|
|
|
|
# Additional packages to add to propagatedBuildInputs
|
|
|
|
, extraPackages ? ps: []
|
|
|
|
|
|
|
|
# Override Python packages using
|
|
|
|
# self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); }
|
|
|
|
# Applied after defaultOverrides
|
2021-02-19 19:06:45 +00:00
|
|
|
, packageOverrides ? self: super: {}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Skip pip install of required packages on startup
|
|
|
|
, skipPip ? true }:
|
|
|
|
|
|
|
|
let
|
|
|
|
defaultOverrides = [
|
2021-09-18 10:52:07 +00:00
|
|
|
# Override the version of some packages pinned in Home Assistant's setup.py and requirements_all.txt
|
2022-03-05 16:20:37 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
(self: super: {
|
2023-11-16 04:20:00 +00:00
|
|
|
aioairq = super.aioairq.overridePythonAttrs (oldAttrs: rec {
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.3.1";
|
2023-11-16 04:20:00 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "CorantGmbH";
|
|
|
|
repo = "aioairq";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-SRsDSHTZkkygaQZjHENKNLx3ZWMi/PubS1m/MonEKNk=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
aioesphomeapi = super.aioesphomeapi.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "19.2.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "esphome";
|
|
|
|
repo = "aioesphomeapi";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-WSWGO0kI1m6oaImUYZ6m5WKJ+xPs/rtn5wVq1bDr+bE=";
|
2023-11-16 04:20:00 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
# https://github.com/home-assistant/core/pull/101913
|
|
|
|
aiohttp = super.aiohttp.overridePythonAttrs (old: rec {
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "3.9.1";
|
2023-11-16 04:20:00 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit (old) pname;
|
|
|
|
inherit version;
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-j8Sah6wmnUUp2kWHHi/7aHTod3nD0OLM2BPAiZIhI50=";
|
|
|
|
};
|
|
|
|
patches = [];
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
aiohttp-zlib-ng = super.aiohttp-zlib-ng.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.1.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bdraco";
|
|
|
|
repo = "aiohttp-zlib-ng";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-dTNwt4eX6ZQ8ySK2/9ziVbc3KFg2aL/EsiBWaJRC4x8=";
|
2023-11-16 04:20:00 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
aiowatttime = super.aiowatttime.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.1.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bachya";
|
|
|
|
repo = "aiowatttime";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-tWnxGLJT+CRFvkhxFamHxnLXBvoR8tfOvzH1o1i5JJg=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
aioresponses = super.aioresponses.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
pname = "aioresponses";
|
|
|
|
version = "0.7.6";
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-95XZ29otYXdIQOfjL1Nm9FdS0a3Bt0yTYq/QFylsfuE=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
astral = super.astral.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
pname = "astral";
|
|
|
|
version = "2.2";
|
2023-07-15 17:15:38 +00:00
|
|
|
src = fetchPypi {
|
2023-01-11 07:51:40 +00:00
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-5B2ZZ9XEi+QhNGVS8PTe2tQ/85qDV09f8q0ytmJ7b74=";
|
|
|
|
};
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2023-10-09 19:29:22 +00:00
|
|
|
--replace "poetry>=1.0.0b1" "poetry-core" \
|
2023-01-11 07:51:40 +00:00
|
|
|
--replace "poetry.masonry" "poetry.core.masonry"
|
|
|
|
'';
|
|
|
|
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [
|
|
|
|
self.pytz
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
geojson = super.geojson.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2.5.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit (oldAttrs.src) owner repo;
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-AcImffYki1gnIaZp/1eacNjdDgjn6qinPJXq9jYtoRg=";
|
|
|
|
};
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
ha-av = super.av.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
pname = "ha-av";
|
|
|
|
version = "10.1.1";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-QaMFVvglipN0kG1+ZQNKk7WTydSyIPn2qa32UtvLidw=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
intellifire4py = super.intellifire4py.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2.2.2";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jeeftor";
|
|
|
|
repo = "intellifire4py";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-iqlKfpnETLqQwy5sNcK2x/TgmuN2hCfYoHEFK2WWVXI=";
|
|
|
|
};
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeBuildInputs = with self; [
|
2023-11-16 04:20:00 +00:00
|
|
|
setuptools
|
|
|
|
];
|
2024-01-02 11:29:13 +00:00
|
|
|
propagatedBuildInputs = with self; [
|
2023-11-16 04:20:00 +00:00
|
|
|
aenum
|
|
|
|
aiohttp
|
|
|
|
pydantic
|
|
|
|
];
|
|
|
|
doCheck = false; # requires asynctest, which does not work on python 3.11
|
|
|
|
});
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
jaraco-abode = super.jaraco-abode.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "3.3.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit (oldAttrs.src) owner repo;
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-LnbWzIST+GMtdsHDKg67WWt9GmHUcSuGZ5Spei3nEio=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
justnimbus = super.justnimbus.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.6.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kvanzuijlen";
|
|
|
|
repo = "justnimbus";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-uQ5Nc5sxqHeAuavyfX4Q6Umsd54aileJjFwOOU6X7Yg=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
notifications-android-tv = super.notifications-android-tv.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.1.5";
|
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "engrbm87";
|
|
|
|
repo = "notifications_android_tv";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-adkcUuPl0jdJjkBINCTW4Kmc16C/HzL+jaRZB/Qr09A=";
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeBuildInputs = with self; [
|
2023-04-12 12:48:02 +00:00
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
propagatedBuildInputs = with self; [
|
2023-04-12 12:48:02 +00:00
|
|
|
requests
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = false; # no tests
|
|
|
|
});
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
openai = super.openai.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.28.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openai";
|
|
|
|
repo = "openai-python";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-liJyeGxnYIC/jUQKdeATHpVJb/12KGbeM94Y2YQphfY=";
|
|
|
|
};
|
|
|
|
nativeBuildInputs = with self; [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
propagatedBuildInputs = with self; [
|
|
|
|
aiohttp
|
|
|
|
requests
|
|
|
|
tqdm
|
|
|
|
];
|
|
|
|
disabledTestPaths = [
|
|
|
|
# Requires a real API key
|
|
|
|
"openai/tests/test_endpoints.py"
|
|
|
|
"openai/tests/asyncio/test_endpoints.py"
|
|
|
|
# openai: command not found
|
|
|
|
"openai/tests/test_file_cli.py"
|
|
|
|
"openai/tests/test_long_examples_validator.py"
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
# Pinned due to API changes in 1.3.0
|
|
|
|
ovoenergy = super.ovoenergy.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "1.2.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "timmo001";
|
|
|
|
repo = "ovoenergy";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-OSK74uvpHuEtWgbLVFrz1NO7lvtHbt690smGQ+GlsOI=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# Pinned due to API changes in 0.1.0
|
2022-09-09 14:08:57 +00:00
|
|
|
poolsense = super.poolsense.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.0.8";
|
2023-07-15 17:15:38 +00:00
|
|
|
src = fetchPypi {
|
2022-09-09 14:08:57 +00:00
|
|
|
pname = "poolsense";
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-17MHrYRmqkH+1QLtgq2d6zaRtqvb9ju9dvPt9gB2xCc=";
|
|
|
|
};
|
|
|
|
});
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
psutil = super.psutil.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "5.9.6";
|
|
|
|
src = fetchPypi {
|
|
|
|
pname = "psutil";
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-5Lkt3NfdTN0/kAGA6h4QSTLHvOI0+4iXbio7KWRBIlo=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
py-synologydsm-api = super.py-synologydsm-api.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2.1.4";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mib1185";
|
|
|
|
repo = "py-synologydsm-api";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-37JzdhMny6YDTBO9NRzfrZJAVAOPnpcr95fOKxisbTg=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
pyasn1 = super.pyasn1.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.4.8";
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit (oldAttrs) pname;
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-rvd8n7lKOsWI6HhBIIvexGRHHZhxvVBQoofMmkdc0Lo=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# Pinned due to API changes >0.3.5.3
|
2022-02-20 05:27:41 +00:00
|
|
|
pyatag = super.pyatag.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.3.5.3";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MatsNl";
|
|
|
|
repo = "pyatag";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "00ly4injmgrj34p0lyx7cz2crgnfcijmzc0540gf7hpwha0marf6";
|
|
|
|
};
|
|
|
|
});
|
2022-01-19 23:45:15 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
pydexcom = super.pydexcom.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.2.3";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gagebenne";
|
|
|
|
repo = "pydexcom";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-ItDGnUUUTwCz4ZJtFVlMYjjoBPn2h8QZgLzgnV2T/Qk=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
pydrawise = super.pydrawise.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2023.11.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dknowles2";
|
|
|
|
repo = "pydrawise";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-gKOyTvdETGzKlpU67UKaHYTIvnAX9znHIynP3BiVbt4=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
pykaleidescape = super.pykaleidescape.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "1.0.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit (oldAttrs.src) owner repo;
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-KM/gtpsQ27QZz2uI1t/yVN5no0zp9LZag1duAJzK55g=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
pysnooz = super.pysnooz.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.8.6";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "AustinBrunkhorst";
|
|
|
|
repo = "pysnooz";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-hJwIObiuFEAVhgZXYB9VCeAlewBBnk0oMkP83MUCpyU=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
python-slugify = super.python-slugify.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
pname = "python-slugify";
|
|
|
|
version = "4.0.1";
|
2023-07-15 17:15:38 +00:00
|
|
|
src = fetchPypi {
|
2022-06-26 10:26:21 +00:00
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-aaUXdm4AwSaOW7/A0BCgqFCN4LGNMK1aH/NX+K5yQnA=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
python-tado = super.python-tado.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.15.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wmalgadey";
|
|
|
|
repo = "PyTado";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-gduqQVw/a64aDzTHFmgZu7OVB53jZb7L5vofzL3Ho6s=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
pytradfri = super.pytradfri.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "9.0.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant-libs";
|
|
|
|
repo = "pytradfri";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-xOdTzG0bF5p1QpkXv2btwrVugQRjSwdAj8bXcC0IoQg=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# Pinned due to API changes ~1.0
|
2021-12-19 01:06:50 +00:00
|
|
|
vultr = super.vultr.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.1.2";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "spry-group";
|
|
|
|
repo = "python-vultr";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = version;
|
|
|
|
hash = "sha256-sHCZ8Csxs5rwg1ZG++hP3MfK7ldeAdqm5ta9tEXeW+I=";
|
2021-12-19 01:06:50 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
# internal python packages only consumed by home-assistant itself
|
2021-06-28 23:13:55 +00:00
|
|
|
home-assistant-frontend = self.callPackage ./frontend.nix { };
|
2023-02-02 18:25:31 +00:00
|
|
|
home-assistant-intents = self.callPackage ./intents.nix { };
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
python = python311.override {
|
2023-02-16 17:41:37 +00:00
|
|
|
packageOverrides = lib.composeManyExtensions (defaultOverrides ++ [ packageOverrides ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
componentPackages = import ./component-packages.nix;
|
|
|
|
|
|
|
|
availableComponents = builtins.attrNames componentPackages.components;
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
inherit (componentPackages) supportedComponentsWithTests;
|
|
|
|
|
|
|
|
getPackages = component: componentPackages.components.${component};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
componentBuildInputs = lib.concatMap (component: getPackages component python.pkgs) extraComponents;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Ensure that we are using a consistent package set
|
2022-01-19 23:45:15 +00:00
|
|
|
extraBuildInputs = extraPackages python.pkgs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Don't forget to run parse-requirements.py after updating
|
2024-01-02 11:29:13 +00:00
|
|
|
hassVersion = "2023.12.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
in python.pkgs.buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "homeassistant";
|
|
|
|
version = assert (componentPackages.version == hassVersion); hassVersion;
|
2022-02-10 20:34:41 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-11 12:50:04 +00:00
|
|
|
# check REQUIRED_PYTHON_VER in homeassistant/const.py
|
2024-01-02 11:29:13 +00:00
|
|
|
disabled = python.pythonOlder "3.11";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
# don't try and fail to strip 6600+ python files, it takes minutes!
|
|
|
|
dontStrip = true;
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
# Primary source is the git, which has the tests and allows bisecting the core
|
|
|
|
src = fetchFromGitHub {
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "home-assistant";
|
2020-05-29 06:06:01 +00:00
|
|
|
repo = "core";
|
2022-12-28 21:21:41 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-XzjsSM0xKxLeuP30u8LReJtmJMbJq+yQ2Pp5xWmNLFw=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Secondary source is pypi sdist for translations
|
|
|
|
sdist = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-dea0PacCzCWhMh2gw/kVJHwYCoT7zJ52qTQbHmqcwU8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = with python.pkgs; [
|
2024-01-02 11:29:13 +00:00
|
|
|
pythonRelaxDepsHook
|
2023-02-09 11:40:11 +00:00
|
|
|
setuptools
|
2023-10-09 19:29:22 +00:00
|
|
|
wheel
|
2023-02-09 11:40:11 +00:00
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"aiohttp"
|
|
|
|
"attrs"
|
|
|
|
"awesomeversion"
|
|
|
|
"bcrypt"
|
|
|
|
"ciso8601"
|
|
|
|
"cryptography"
|
|
|
|
"home-assistant-bluetooth"
|
|
|
|
"httpx"
|
|
|
|
"ifaddr"
|
|
|
|
"orjson"
|
|
|
|
"pip"
|
|
|
|
"PyJWT"
|
|
|
|
"pyOpenSSL"
|
|
|
|
"PyYAML"
|
|
|
|
"requests"
|
|
|
|
"typing-extensions"
|
|
|
|
"voluptuous-serialize"
|
|
|
|
"yarl"
|
|
|
|
];
|
|
|
|
|
|
|
|
# extract translations from pypi sdist
|
2023-03-04 12:14:45 +00:00
|
|
|
prePatch = ''
|
2024-01-02 11:29:13 +00:00
|
|
|
tar --extract --gzip --file $sdist --strip-components 1 --wildcards "**/translations"
|
2023-03-04 12:14:45 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
# leave this in, so users don't have to constantly update their downstream patch handling
|
2021-03-09 03:18:52 +00:00
|
|
|
patches = [
|
2023-11-16 04:20:00 +00:00
|
|
|
# Follow symlinks in /var/lib/hass/www
|
|
|
|
./patches/static-symlinks.patch
|
|
|
|
|
|
|
|
# Patch path to ffmpeg binary
|
2021-12-19 01:06:50 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./patches/ffmpeg-path.patch;
|
2022-12-02 08:20:57 +00:00
|
|
|
ffmpeg = "${lib.getBin ffmpeg-headless}/bin/ffmpeg";
|
2021-12-19 01:06:50 +00:00
|
|
|
})
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
2020-11-06 00:33:48 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
postPatch = ''
|
2020-10-11 12:50:04 +00:00
|
|
|
substituteInPlace tests/test_config.py --replace '"/usr"' '"/build/media"'
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
sed -i 's/setuptools[~=]/setuptools>/' pyproject.toml
|
|
|
|
sed -i 's/wheel[~=]/wheel>/' pyproject.toml
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2023-02-09 11:40:11 +00:00
|
|
|
# Only packages required in pyproject.toml
|
2021-02-05 17:12:51 +00:00
|
|
|
aiohttp
|
|
|
|
astral
|
|
|
|
async-timeout
|
2022-07-14 12:49:19 +00:00
|
|
|
atomicwrites-homeassistant
|
2021-02-05 17:12:51 +00:00
|
|
|
attrs
|
2021-02-13 14:23:35 +00:00
|
|
|
awesomeversion
|
2021-02-05 17:12:51 +00:00
|
|
|
bcrypt
|
|
|
|
certifi
|
|
|
|
ciso8601
|
|
|
|
cryptography
|
|
|
|
httpx
|
2022-08-12 12:06:08 +00:00
|
|
|
home-assistant-bluetooth
|
2021-12-30 13:39:12 +00:00
|
|
|
ifaddr
|
2021-02-05 17:12:51 +00:00
|
|
|
jinja2
|
2022-07-14 12:49:19 +00:00
|
|
|
lru-dict
|
|
|
|
orjson
|
2023-10-09 19:29:22 +00:00
|
|
|
packaging
|
2021-02-05 17:12:51 +00:00
|
|
|
pip
|
2023-02-09 11:40:11 +00:00
|
|
|
pyopenssl
|
2021-02-05 17:12:51 +00:00
|
|
|
pyjwt
|
|
|
|
python-slugify
|
|
|
|
pyyaml
|
|
|
|
requests
|
2023-04-12 12:48:02 +00:00
|
|
|
ulid-transform
|
2021-02-05 17:12:51 +00:00
|
|
|
voluptuous
|
|
|
|
voluptuous-serialize
|
|
|
|
yarl
|
2024-01-02 11:29:13 +00:00
|
|
|
# REQUIREMENTS in homeassistant/auth/mfa_modules/totp.py and homeassistant/auth/mfa_modules/notify.py
|
|
|
|
pyotp
|
|
|
|
pyqrcode
|
2023-02-09 11:40:11 +00:00
|
|
|
# Implicit dependency via homeassistant/requirements.py
|
2021-06-28 23:13:55 +00:00
|
|
|
setuptools
|
2023-02-22 10:55:15 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip";
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
# upstream only tests on Linux, so do we.
|
|
|
|
doCheck = stdenv.isLinux;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = with python.pkgs; [
|
2021-05-20 23:08:51 +00:00
|
|
|
# test infrastructure (selectively from requirement_test.txt)
|
2021-12-06 16:07:01 +00:00
|
|
|
freezegun
|
2023-01-11 07:51:40 +00:00
|
|
|
pytest-asyncio
|
2021-02-05 17:12:51 +00:00
|
|
|
pytest-aiohttp
|
2023-02-09 11:40:11 +00:00
|
|
|
pytest-freezer
|
2021-05-20 23:08:51 +00:00
|
|
|
pytest-mock
|
2021-03-09 03:18:52 +00:00
|
|
|
pytest-rerunfailures
|
2021-12-06 16:07:01 +00:00
|
|
|
pytest-socket
|
2023-02-09 11:40:11 +00:00
|
|
|
pytest-timeout
|
2023-01-11 07:51:40 +00:00
|
|
|
pytest-unordered
|
2021-02-05 17:12:51 +00:00
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
requests-mock
|
2021-03-09 03:18:52 +00:00
|
|
|
respx
|
2023-03-04 12:14:45 +00:00
|
|
|
syrupy
|
2023-02-09 11:40:11 +00:00
|
|
|
tomli
|
|
|
|
# Sneakily imported in tests/conftest.py
|
|
|
|
paho-mqtt
|
2022-01-19 23:45:15 +00:00
|
|
|
] ++ lib.concatMap (component: getPackages component python.pkgs) [
|
|
|
|
# some components are needed even if tests in tests/components are disabled
|
2020-10-11 12:50:04 +00:00
|
|
|
"default_config"
|
2021-02-05 17:12:51 +00:00
|
|
|
"hue"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2020-10-11 12:50:04 +00:00
|
|
|
pytestFlagsArray = [
|
2021-05-20 23:08:51 +00:00
|
|
|
# assign tests grouped by file to workers
|
|
|
|
"--dist loadfile"
|
2021-03-09 03:18:52 +00:00
|
|
|
# retry racy tests that end in "RuntimeError: Event loop is closed"
|
|
|
|
"--reruns 3"
|
|
|
|
"--only-rerun RuntimeError"
|
2021-05-20 23:08:51 +00:00
|
|
|
# enable full variable printing on error
|
|
|
|
"--showlocals"
|
2023-02-09 11:40:11 +00:00
|
|
|
# AssertionError: assert 1 == 0
|
|
|
|
"--deselect tests/test_config.py::test_merge"
|
2023-11-16 04:20:00 +00:00
|
|
|
# AssertionError: assert 'WARNING' not in '2023-11-10 ...nt abc[L]>\n'"
|
|
|
|
"--deselect=tests/helpers/test_script.py::test_multiple_runs_repeat_choose"
|
2024-01-02 11:29:13 +00:00
|
|
|
# SystemError: PyThreadState_SetAsyncExc failed
|
|
|
|
"--deselect=tests/helpers/test_template.py::test_template_timeout"
|
2021-05-20 23:08:51 +00:00
|
|
|
# tests are located in tests/
|
|
|
|
"tests"
|
2022-01-19 23:45:15 +00:00
|
|
|
];
|
2020-10-11 12:50:04 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
disabledTestPaths = [
|
2022-06-16 17:23:12 +00:00
|
|
|
# we neither run nor distribute hassfest
|
|
|
|
"tests/hassfest"
|
|
|
|
# we don't care about code quality
|
|
|
|
"tests/pylint"
|
2021-03-09 03:18:52 +00:00
|
|
|
# don't bulk test all components
|
|
|
|
"tests/components"
|
2020-10-11 12:50:04 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
2021-04-08 16:26:57 +00:00
|
|
|
export HOME="$TEMPDIR"
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
# the tests require the existance of a media dir
|
|
|
|
mkdir /build/media
|
2021-04-08 16:26:57 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# put ping binary into PATH, e.g. for wake_on_lan tests
|
|
|
|
export PATH=${inetutils}/bin:$PATH
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
passthru = {
|
2022-01-19 23:45:15 +00:00
|
|
|
inherit
|
|
|
|
availableComponents
|
|
|
|
extraComponents
|
|
|
|
getPackages
|
|
|
|
python
|
|
|
|
supportedComponentsWithTests;
|
2023-07-15 17:15:38 +00:00
|
|
|
pythonPath = python.pkgs.makePythonPath (componentBuildInputs ++ extraBuildInputs);
|
2023-03-15 16:39:30 +00:00
|
|
|
frontend = python.pkgs.home-assistant-frontend;
|
2023-02-02 18:25:31 +00:00
|
|
|
intents = python.pkgs.home-assistant-intents;
|
2020-06-15 15:56:04 +00:00
|
|
|
tests = {
|
2022-01-19 23:45:15 +00:00
|
|
|
nixos = nixosTests.home-assistant;
|
|
|
|
components = callPackage ./tests.nix { };
|
2022-12-28 21:21:41 +00:00
|
|
|
version = testers.testVersion {
|
|
|
|
package = home-assistant;
|
|
|
|
command = "hass --version";
|
|
|
|
};
|
2020-06-15 15:56:04 +00:00
|
|
|
};
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://home-assistant.io/";
|
2020-10-16 20:44:37 +00:00
|
|
|
description = "Open source home automation that puts local control and privacy first";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2021-04-08 16:26:57 +00:00
|
|
|
maintainers = teams.home-assistant.members;
|
2021-04-05 15:23:46 +00:00
|
|
|
platforms = platforms.linux;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "hass";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|