2021-03-07 04:46:28 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2022-01-15 00:20:08 +00:00
|
|
|
, callPackage
|
2021-03-07 04:46:28 +00:00
|
|
|
, fetchFromGitHub
|
2023-03-02 01:29:14 +00:00
|
|
|
, fetchPypi
|
2021-12-11 19:59:08 +00:00
|
|
|
, fetchpatch
|
2021-03-07 04:46:28 +00:00
|
|
|
, python3
|
2021-12-11 19:59:08 +00:00
|
|
|
, substituteAll
|
2022-12-01 10:39:22 +00:00
|
|
|
, ffmpeg-headless
|
2021-05-18 00:43:52 +00:00
|
|
|
, inetutils
|
2021-03-07 04:46:28 +00:00
|
|
|
, nixosTests
|
2022-12-21 16:45:07 +00:00
|
|
|
, home-assistant
|
|
|
|
, testers
|
2018-07-29 19:49:46 +00:00
|
|
|
|
|
|
|
# Look up dependencies of specified components in component-packages.nix
|
2019-12-20 07:25:56 +00:00
|
|
|
, extraComponents ? [ ]
|
2018-07-29 19:49:46 +00:00
|
|
|
|
|
|
|
# Additional packages to add to propagatedBuildInputs
|
2018-01-14 21:26:52 +00:00
|
|
|
, extraPackages ? ps: []
|
2018-07-29 19:49:46 +00:00
|
|
|
|
2022-02-14 00:48:09 +00:00
|
|
|
# Write out info about included extraComponents and extraPackages
|
|
|
|
, writeText
|
|
|
|
|
2018-08-21 00:27:55 +00:00
|
|
|
# Override Python packages using
|
|
|
|
# self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); }
|
|
|
|
# Applied after defaultOverrides
|
2021-02-04 14:02:14 +00:00
|
|
|
, packageOverrides ? self: super: {}
|
2018-08-21 00:27:55 +00:00
|
|
|
|
2018-07-29 19:49:46 +00:00
|
|
|
# Skip pip install of required packages on startup
|
2018-01-14 21:26:52 +00:00
|
|
|
, skipPip ? true }:
|
|
|
|
|
|
|
|
let
|
2018-08-21 00:27:55 +00:00
|
|
|
defaultOverrides = [
|
2021-09-10 01:59:36 +00:00
|
|
|
# Override the version of some packages pinned in Home Assistant's setup.py and requirements_all.txt
|
|
|
|
|
2022-07-21 12:07:40 +00:00
|
|
|
(self: super: {
|
2023-01-18 13:46:42 +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=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-01-01 00:04:10 +00:00
|
|
|
astral = super.astral.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
pname = "astral";
|
|
|
|
version = "2.2";
|
|
|
|
src = self.fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-5B2ZZ9XEi+QhNGVS8PTe2tQ/85qDV09f8q0ytmJ7b74=";
|
|
|
|
};
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace "poetry.masonry" "poetry.core.masonry"
|
|
|
|
'';
|
|
|
|
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [
|
|
|
|
self.pytz
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2023-01-17 11:48:24 +00:00
|
|
|
dsmr-parser = super.dsmr-parser.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.33";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ndokter";
|
|
|
|
repo = "dsmr_parser";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-Phx8Yqx6beTzkQv0fU8Pfs2btPgKVARdO+nMcne1S+w=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-03-17 13:39:38 +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;
|
|
|
|
});
|
|
|
|
|
|
|
|
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-01-18 13:03:16 +00:00
|
|
|
# Pinned due to API changes in 10.0
|
|
|
|
mcstatus = super.mcstatus.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "9.3.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "py-mine";
|
|
|
|
repo = "mcstatus";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-kNThVElEDqhbCitktBv5tQkjMaU4IsX0dJk63hvLhb0=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-04-09 11:14:28 +00:00
|
|
|
# moto tests are a nuissance
|
|
|
|
moto = super.moto.overridePythonAttrs (_: {
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
|
2023-04-09 21:20:37 +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=";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = with super; [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = with super; [
|
|
|
|
requests
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = false; # no tests
|
|
|
|
});
|
|
|
|
|
2023-01-18 13:28: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-14 23:24:46 +00:00
|
|
|
# Pinned due to API changes in 0.1.0
|
2022-07-26 11:13:53 +00:00
|
|
|
poolsense = super.poolsense.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.0.8";
|
|
|
|
src = super.fetchPypi {
|
|
|
|
pname = "poolsense";
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-17MHrYRmqkH+1QLtgq2d6zaRtqvb9ju9dvPt9gB2xCc=";
|
|
|
|
};
|
|
|
|
});
|
2021-09-10 01:59:36 +00:00
|
|
|
|
2023-03-17 13:39:38 +00:00
|
|
|
p1monitor = super.p1monitor.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2.1.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit (oldAttrs.src) owner repo;
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-VHY5AWxt5BZd1NQKzsgubEZBLKAlDNm8toyEazPUnDU=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-05-04 00:25:35 +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=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-10-14 23:24:46 +00:00
|
|
|
# Pinned due to API changes >0.3.5.3
|
2022-02-11 11:28:46 +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-11 12:46:41 +00:00
|
|
|
|
2023-03-17 13:39:38 +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-05-04 00:25:35 +00:00
|
|
|
python-roborock = super.python-roborock.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.8.3";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "humbertogontijo";
|
|
|
|
repo = "python-roborock";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-O7MjxCQ4JwFFC2ibdU8hCPhFPQhV5/LsmDO6vRdyYL0=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-06-03 11:47:55 +00:00
|
|
|
python-slugify = super.python-slugify.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
pname = "python-slugify";
|
|
|
|
version = "4.0.1";
|
|
|
|
src = super.fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-aaUXdm4AwSaOW7/A0BCgqFCN4LGNMK1aH/NX+K5yQnA=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-02-01 23:15:24 +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=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-01-09 21:08:10 +00:00
|
|
|
python-telegram-bot = super.python-telegram-bot.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "13.15";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "python-telegram-bot";
|
|
|
|
repo = "python-telegram-bot";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-EViSjr/nnuJIDTwV8j/O50hJkWV3M5aTNnWyzrinoyg=";
|
|
|
|
};
|
|
|
|
propagatedBuildInputs = [
|
2023-02-19 16:15:19 +00:00
|
|
|
self.apscheduler
|
2023-01-09 21:08:10 +00:00
|
|
|
self.cachetools
|
|
|
|
self.certifi
|
|
|
|
self.cryptography
|
|
|
|
self.decorator
|
|
|
|
self.future
|
|
|
|
self.tornado
|
|
|
|
self.urllib3
|
|
|
|
];
|
|
|
|
setupPyGlobalFlags = [ "--with-upstream-urllib3" ];
|
|
|
|
postPatch = ''
|
|
|
|
rm -r telegram/vendor
|
|
|
|
substituteInPlace requirements.txt \
|
|
|
|
--replace "APScheduler==3.6.3" "APScheduler" \
|
|
|
|
--replace "cachetools==4.2.2" "cachetools" \
|
|
|
|
--replace "tornado==6.1" "tornado"
|
|
|
|
'';
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
|
2023-03-02 01:29:14 +00:00
|
|
|
sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec {
|
2023-05-04 00:25:35 +00:00
|
|
|
version = "2.0.12";
|
2023-03-02 01:29:14 +00:00
|
|
|
src = super.fetchPypi {
|
|
|
|
pname = "SQLAlchemy";
|
|
|
|
inherit version;
|
2023-05-04 00:25:35 +00:00
|
|
|
hash = "sha256-vd/FvR3uXbD93J2rJvgAwoPzJD5ygbvxByAP7TASX5w=";
|
2023-03-02 01:29:14 +00:00
|
|
|
};
|
2023-03-17 13:39:38 +00:00
|
|
|
});
|
|
|
|
|
2022-10-14 23:24:46 +00:00
|
|
|
# Pinned due to API changes in 0.3.0
|
2022-09-08 00:12:45 +00:00
|
|
|
tailscale = super.tailscale.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.2.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "frenck";
|
|
|
|
repo = "python-tailscale";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-/tS9ZMUWsj42n3MYPZJYJELzX3h02AIHeRZmD2SuwWE=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-10-14 23:24:46 +00:00
|
|
|
# Pinned due to API changes in 0.4.0
|
2021-12-11 19:59:08 +00:00
|
|
|
vilfo-api-client = super.vilfo-api-client.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.3.3";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ManneW";
|
|
|
|
repo = "vilfo-api-client-python";
|
2022-05-04 19:44:09 +00:00
|
|
|
rev = "v${version}";
|
2021-12-11 19:59:08 +00:00
|
|
|
sha256 = "1gy5gpsg99rcm1cc3m30232za00r9i46sp74zpd12p3vzz1wyyqf";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-10-14 23:24:46 +00:00
|
|
|
# Pinned due to API changes ~1.0
|
2021-12-11 19:59:08 +00:00
|
|
|
vultr = super.vultr.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.1.2";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "spry-group";
|
|
|
|
repo = "python-vultr";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1qjvvr2v9gfnwskdl0ayazpcmiyw9zlgnijnhgq9mcri5gq9jw5h";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-04-09 11:14:28 +00:00
|
|
|
websockets = super.websockets.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "11.0.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aaugustin";
|
|
|
|
repo = "websockets";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-cD8pC7n2OGS8AjG0VdjNXi8jXxvN7yKkadNR0GCqc90=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-01-12 05:06:41 +00:00
|
|
|
# internal python packages only consumed by home-assistant itself
|
2021-06-15 13:28:31 +00:00
|
|
|
home-assistant-frontend = self.callPackage ./frontend.nix { };
|
2023-01-12 05:06:41 +00:00
|
|
|
home-assistant-intents = self.callPackage ./intents.nix { };
|
2018-08-21 00:27:55 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
python = python3.override {
|
2022-07-19 11:25:52 +00:00
|
|
|
packageOverrides = lib.composeManyExtensions (defaultOverrides ++ [ packageOverrides ]);
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
|
|
|
|
2018-02-01 12:42:07 +00:00
|
|
|
componentPackages = import ./component-packages.nix;
|
|
|
|
|
|
|
|
availableComponents = builtins.attrNames componentPackages.components;
|
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
inherit (componentPackages) supportedComponentsWithTests;
|
2018-02-01 12:42:07 +00:00
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
getPackages = component: componentPackages.components.${component};
|
|
|
|
|
|
|
|
componentBuildInputs = lib.concatMap (component: getPackages component python.pkgs) extraComponents;
|
2018-02-01 12:42:07 +00:00
|
|
|
|
2018-01-14 21:26:52 +00:00
|
|
|
# Ensure that we are using a consistent package set
|
2022-01-15 00:20:08 +00:00
|
|
|
extraBuildInputs = extraPackages python.pkgs;
|
2018-01-14 21:26:52 +00:00
|
|
|
|
2018-02-01 12:42:07 +00:00
|
|
|
# Don't forget to run parse-requirements.py after updating
|
2023-05-23 22:06:36 +00:00
|
|
|
hassVersion = "2023.5.4";
|
2018-02-01 12:42:07 +00:00
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
in python.pkgs.buildPythonApplication rec {
|
2018-01-14 21:26:52 +00:00
|
|
|
pname = "homeassistant";
|
2018-02-01 12:42:07 +00:00
|
|
|
version = assert (componentPackages.version == hassVersion); hassVersion;
|
2022-02-02 20:53:50 +00:00
|
|
|
format = "pyproject";
|
2018-01-14 21:26:52 +00:00
|
|
|
|
2020-10-07 18:28:25 +00:00
|
|
|
# check REQUIRED_PYTHON_VER in homeassistant/const.py
|
2023-02-01 23:15:24 +00:00
|
|
|
disabled = python.pythonOlder "3.10";
|
2020-02-26 15:51:25 +00:00
|
|
|
|
2021-01-06 23:20:39 +00:00
|
|
|
# don't try and fail to strip 6600+ python files, it takes minutes!
|
|
|
|
dontStrip = true;
|
|
|
|
|
2023-03-02 01:29:14 +00:00
|
|
|
# Primary source is the pypi sdist, because it contains translations
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-05-23 22:06:36 +00:00
|
|
|
hash = "sha256-mRiRKMafRkgAOshH/5i6yj379FEzZgXhkdkK557sMaQ=";
|
2023-03-02 01:29:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Secondary source is git for tests
|
|
|
|
gitSrc = fetchFromGitHub {
|
2018-01-14 21:26:52 +00:00
|
|
|
owner = "home-assistant";
|
2020-05-20 21:41:42 +00:00
|
|
|
repo = "core";
|
2022-12-21 17:43:58 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-05-23 22:06:36 +00:00
|
|
|
hash = "sha256-r28BhC6lBIoxu7Wp/1h+qgPEDaUCqH4snyKk/h/vgyQ=";
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-03 14:49:42 +00:00
|
|
|
nativeBuildInputs = with python3.pkgs; [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2023-03-02 01:29:14 +00:00
|
|
|
# copy tests early, so patches apply as they would to the git repo
|
|
|
|
prePatch = ''
|
|
|
|
cp --no-preserve=mode --recursive ${gitSrc}/tests ./
|
|
|
|
chmod u+x tests/auth/providers/test_command_line_cmd.sh
|
|
|
|
'';
|
|
|
|
|
2020-11-04 11:52:54 +00:00
|
|
|
# leave this in, so users don't have to constantly update their downstream patch handling
|
2021-03-07 04:46:28 +00:00
|
|
|
patches = [
|
2021-12-11 19:59:08 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./patches/ffmpeg-path.patch;
|
2022-12-01 10:39:22 +00:00
|
|
|
ffmpeg = "${lib.getBin ffmpeg-headless}/bin/ffmpeg";
|
2021-12-11 19:59:08 +00:00
|
|
|
})
|
2021-03-07 04:46:28 +00:00
|
|
|
];
|
2020-11-04 11:52:54 +00:00
|
|
|
|
2022-01-16 21:04:42 +00:00
|
|
|
postPatch = let
|
|
|
|
relaxedConstraints = [
|
2022-11-09 06:10:46 +00:00
|
|
|
"aiohttp"
|
2022-01-16 21:04:42 +00:00
|
|
|
"attrs"
|
|
|
|
"awesomeversion"
|
|
|
|
"bcrypt"
|
2023-01-01 00:04:10 +00:00
|
|
|
"ciso8601"
|
2022-06-05 12:26:25 +00:00
|
|
|
"cryptography"
|
2022-08-03 16:17:18 +00:00
|
|
|
"home-assistant-bluetooth"
|
2022-01-16 21:04:42 +00:00
|
|
|
"httpx"
|
2022-07-19 16:05:08 +00:00
|
|
|
"ifaddr"
|
2022-07-06 21:09:18 +00:00
|
|
|
"orjson"
|
2023-03-01 00:46:43 +00:00
|
|
|
"pip"
|
2022-06-01 15:13:09 +00:00
|
|
|
"PyJWT"
|
2023-02-01 23:15:24 +00:00
|
|
|
"pyOpenSSL"
|
2022-06-27 10:14:59 +00:00
|
|
|
"requests"
|
2022-10-09 20:30:30 +00:00
|
|
|
"typing-extensions"
|
2023-03-01 00:46:43 +00:00
|
|
|
"voluptuous-serialize"
|
2022-09-15 03:18:02 +00:00
|
|
|
"yarl"
|
2022-01-16 21:04:42 +00:00
|
|
|
];
|
|
|
|
in ''
|
|
|
|
sed -r -i \
|
|
|
|
${lib.concatStringsSep "\n" (map (package:
|
2022-07-06 21:09:18 +00:00
|
|
|
''-e 's/${package}[<>=]+.*/${package}",/g' \''
|
2022-01-16 21:04:42 +00:00
|
|
|
) relaxedConstraints)}
|
2022-07-06 21:09:18 +00:00
|
|
|
pyproject.toml
|
2020-10-07 18:28:25 +00:00
|
|
|
substituteInPlace tests/test_config.py --replace '"/usr"' '"/build/media"'
|
2020-08-18 08:07:27 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2023-02-03 14:49:42 +00:00
|
|
|
# Only packages required in pyproject.toml
|
2021-02-04 16:36:21 +00:00
|
|
|
aiohttp
|
|
|
|
astral
|
|
|
|
async-timeout
|
2022-07-09 00:19:46 +00:00
|
|
|
atomicwrites-homeassistant
|
2021-02-04 16:36:21 +00:00
|
|
|
attrs
|
2021-02-05 13:48:53 +00:00
|
|
|
awesomeversion
|
2021-02-04 16:36:21 +00:00
|
|
|
bcrypt
|
|
|
|
certifi
|
|
|
|
ciso8601
|
|
|
|
cryptography
|
|
|
|
httpx
|
2022-08-03 16:17:18 +00:00
|
|
|
home-assistant-bluetooth
|
2021-12-28 15:43:50 +00:00
|
|
|
ifaddr
|
2021-02-04 16:36:21 +00:00
|
|
|
jinja2
|
2022-07-06 21:09:18 +00:00
|
|
|
lru-dict
|
|
|
|
orjson
|
2021-02-04 16:36:21 +00:00
|
|
|
pip
|
2023-02-03 14:49:42 +00:00
|
|
|
pyopenssl
|
2021-02-04 16:36:21 +00:00
|
|
|
pyjwt
|
|
|
|
python-slugify
|
|
|
|
pyyaml
|
|
|
|
requests
|
2023-04-05 21:30:07 +00:00
|
|
|
ulid-transform
|
2021-02-04 16:36:21 +00:00
|
|
|
voluptuous
|
|
|
|
voluptuous-serialize
|
|
|
|
yarl
|
2023-02-03 14:49:42 +00:00
|
|
|
# Implicit dependency via homeassistant/requirements.py
|
2021-06-27 16:38:36 +00:00
|
|
|
setuptools
|
2023-02-20 15:54:37 +00:00
|
|
|
];
|
2018-01-14 21:26:52 +00:00
|
|
|
|
2021-02-06 03:47:04 +00:00
|
|
|
makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip";
|
|
|
|
|
2020-05-06 06:27:19 +00:00
|
|
|
# upstream only tests on Linux, so do we.
|
|
|
|
doCheck = stdenv.isLinux;
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = with python.pkgs; [
|
2021-05-10 19:25:43 +00:00
|
|
|
# test infrastructure (selectively from requirement_test.txt)
|
2021-11-03 21:28:03 +00:00
|
|
|
freezegun
|
2023-01-04 22:13:31 +00:00
|
|
|
pytest-asyncio
|
2021-02-04 16:36:21 +00:00
|
|
|
pytest-aiohttp
|
2023-02-03 14:49:42 +00:00
|
|
|
pytest-freezer
|
2021-05-07 15:22:57 +00:00
|
|
|
pytest-mock
|
2021-03-02 16:56:33 +00:00
|
|
|
pytest-rerunfailures
|
2021-11-03 21:28:03 +00:00
|
|
|
pytest-socket
|
2023-02-03 14:49:42 +00:00
|
|
|
pytest-timeout
|
2023-01-04 22:13:31 +00:00
|
|
|
pytest-unordered
|
2021-02-04 16:36:21 +00:00
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
requests-mock
|
2021-02-06 03:47:04 +00:00
|
|
|
respx
|
2022-01-15 00:20:08 +00:00
|
|
|
stdlib-list
|
2023-03-02 01:29:14 +00:00
|
|
|
syrupy
|
2023-02-03 14:49:42 +00:00
|
|
|
tomli
|
|
|
|
# required through tests/auth/mfa_modules/test_otp.py
|
2021-05-10 19:25:43 +00:00
|
|
|
pyotp
|
2023-02-03 14:49:42 +00:00
|
|
|
# Sneakily imported in tests/conftest.py
|
|
|
|
paho-mqtt
|
2022-01-15 00:20:08 +00:00
|
|
|
] ++ lib.concatMap (component: getPackages component python.pkgs) [
|
|
|
|
# some components are needed even if tests in tests/components are disabled
|
2020-10-07 23:27:42 +00:00
|
|
|
"default_config"
|
2021-02-04 16:36:21 +00:00
|
|
|
"hue"
|
2023-02-03 14:49:42 +00:00
|
|
|
# for tests/test_config.py::test_merge_id_schema
|
|
|
|
"qwikswitch"
|
2020-10-07 23:27:42 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
2021-05-18 00:43:52 +00:00
|
|
|
# assign tests grouped by file to workers
|
|
|
|
"--dist loadfile"
|
2021-03-02 16:56:33 +00:00
|
|
|
# retry racy tests that end in "RuntimeError: Event loop is closed"
|
|
|
|
"--reruns 3"
|
|
|
|
"--only-rerun RuntimeError"
|
2021-05-15 14:56:35 +00:00
|
|
|
# enable full variable printing on error
|
|
|
|
"--showlocals"
|
2023-02-03 14:49:42 +00:00
|
|
|
# AssertionError: assert 1 == 0
|
|
|
|
"--deselect tests/test_config.py::test_merge"
|
2023-04-05 21:30:07 +00:00
|
|
|
# AssertionError: assert 2 == 1
|
|
|
|
"--deselect=tests/helpers/test_translation.py::test_caching"
|
2021-05-18 00:43:52 +00:00
|
|
|
# tests are located in tests/
|
|
|
|
"tests"
|
2022-01-15 00:20:08 +00:00
|
|
|
];
|
2020-10-07 23:27:42 +00:00
|
|
|
|
2021-02-06 03:47:04 +00:00
|
|
|
disabledTestPaths = [
|
2022-05-25 00:43:47 +00:00
|
|
|
# we neither run nor distribute hassfest
|
|
|
|
"tests/hassfest"
|
2022-05-22 20:58:11 +00:00
|
|
|
# we don't care about code quality
|
|
|
|
"tests/pylint"
|
2021-02-06 03:47:04 +00:00
|
|
|
# don't bulk test all components
|
|
|
|
"tests/components"
|
2020-10-07 23:27:42 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
2021-04-07 18:34:08 +00:00
|
|
|
export HOME="$TEMPDIR"
|
|
|
|
|
2020-10-01 02:07:05 +00:00
|
|
|
# the tests require the existance of a media dir
|
|
|
|
mkdir /build/media
|
2021-04-06 23:41:57 +00:00
|
|
|
|
2021-05-18 00:43:52 +00:00
|
|
|
# put ping binary into PATH, e.g. for wake_on_lan tests
|
|
|
|
export PATH=${inetutils}/bin:$PATH
|
2018-01-14 21:26:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-06 06:39:44 +00:00
|
|
|
passthru = {
|
2022-01-15 00:20:08 +00:00
|
|
|
inherit
|
|
|
|
availableComponents
|
|
|
|
extraComponents
|
|
|
|
getPackages
|
|
|
|
python
|
|
|
|
supportedComponentsWithTests;
|
2023-02-20 15:54:37 +00:00
|
|
|
pythonPath = python3.pkgs.makePythonPath (componentBuildInputs ++ extraBuildInputs);
|
2023-03-09 22:38:14 +00:00
|
|
|
frontend = python.pkgs.home-assistant-frontend;
|
2023-01-12 05:06:41 +00:00
|
|
|
intents = python.pkgs.home-assistant-intents;
|
2020-06-20 10:05:30 +00:00
|
|
|
tests = {
|
2022-01-15 00:20:08 +00:00
|
|
|
nixos = nixosTests.home-assistant;
|
|
|
|
components = callPackage ./tests.nix { };
|
2022-12-21 16:45:07 +00:00
|
|
|
version = testers.testVersion {
|
|
|
|
package = home-assistant;
|
|
|
|
command = "hass --version";
|
|
|
|
};
|
2020-06-20 10:05:30 +00:00
|
|
|
};
|
2020-05-06 06:39:44 +00:00
|
|
|
};
|
|
|
|
|
2018-02-10 22:19:19 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://home-assistant.io/";
|
2020-10-15 11:01:10 +00:00
|
|
|
description = "Open source home automation that puts local control and privacy first";
|
2018-01-14 21:26:52 +00:00
|
|
|
license = licenses.asl20;
|
2021-04-05 23:16:25 +00:00
|
|
|
maintainers = teams.home-assistant.members;
|
2021-04-03 21:39:33 +00:00
|
|
|
platforms = platforms.linux;
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
|
|
|
}
|