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
|
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
|
|
|
|
, ffmpeg
|
2021-05-18 00:43:52 +00:00
|
|
|
, inetutils
|
2021-03-07 04:46:28 +00:00
|
|
|
, nixosTests
|
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-08-03 09:03:10 +00:00
|
|
|
(self: super: {
|
|
|
|
advantage-air = super.advantage-air.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.3.1";
|
|
|
|
src = super.fetchPypi {
|
|
|
|
pname = "advantage_air";
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-C+cB6oHmbr9mHZKnbls42yenQy3+L8huLk9wKazIWfU=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2022-07-21 12:07:40 +00:00
|
|
|
(self: super: {
|
|
|
|
backoff = super.backoff.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "1.11.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "litl";
|
|
|
|
repo = "backoff";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-87IMcLaoCn0Vns8Ub/AFmv0gXtS0aPZX0cSt7+lOPm4=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2022-07-06 21:09:18 +00:00
|
|
|
(self: super: {
|
|
|
|
bsblan = super.bsblan.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.5.0";
|
|
|
|
postPatch = null;
|
|
|
|
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ super.cattrs ];
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "liudger";
|
|
|
|
repo = "python-bsblan";
|
|
|
|
rev = "v.${version}";
|
|
|
|
hash = "sha256-yzlHcIb5QlG+jAgEtKlAcY7rESiUY7nD1YwqK63wgcg=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2022-08-03 09:03:10 +00:00
|
|
|
(self: super: {
|
|
|
|
gridnet = super.gridnet.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "4.0.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "klaasnicolaas";
|
|
|
|
repo = "python-gridnet";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-Ihs8qUx50tAUcRBsVArRhzoLcQUi1vbYh8sPyK75AEk=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
(self: super: {
|
|
|
|
p1monitor = super.p1monitor.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "1.0.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "klaasnicolaas";
|
|
|
|
repo = "python-p1monitor";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-g3isA2gF2AD+VVzTqpnD+YiJQ9Kcl0VKvwd5l5Yx/Uo=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2022-03-04 10:30:40 +00:00
|
|
|
# pytest-aiohttp>0.3.0 breaks home-assistant tests
|
|
|
|
(self: super: {
|
|
|
|
pytest-aiohttp = super.pytest-aiohttp.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.3.0";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
2022-03-06 00:36:48 +00:00
|
|
|
hash = "sha256-ySmFQzljeXc3WDhwO2L+9jUoWYvAqdRRY566lfSqpE8=";
|
2022-03-04 10:30:40 +00:00
|
|
|
};
|
2022-03-06 00:36:48 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [ aiohttp pytest ];
|
|
|
|
doCheck = false;
|
|
|
|
patches = [];
|
2022-03-04 10:30:40 +00:00
|
|
|
});
|
|
|
|
aiohomekit = super.aiohomekit.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires aiohttp>=1.0.0
|
|
|
|
});
|
2022-05-04 20:49:24 +00:00
|
|
|
gcal-sync = super.gcal-sync.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires aiohttp>=1.0.0
|
|
|
|
});
|
2022-03-04 10:30:40 +00:00
|
|
|
hass-nabucasa = super.hass-nabucasa.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires aiohttp>=1.0.0
|
|
|
|
});
|
2022-05-04 20:49:24 +00:00
|
|
|
pynws = super.pynws.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires pytest-aiohttp>=1.0.0
|
|
|
|
});
|
|
|
|
pytomorrowio = super.pytomorrowio.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires pytest-aiohttp>=1.0.0
|
|
|
|
});
|
2022-04-12 23:40:37 +00:00
|
|
|
rtsp-to-webrtc = super.rtsp-to-webrtc.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires pytest-aiohttp>=1.0.0
|
|
|
|
});
|
2022-03-06 00:36:48 +00:00
|
|
|
snitun = super.snitun.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires aiohttp>=1.0.0
|
|
|
|
});
|
2022-03-04 10:30:40 +00:00
|
|
|
zwave-js-server-python = super.zwave-js-server-python.overridePythonAttrs (oldAttrs: {
|
|
|
|
doCheck = false; # requires aiohttp>=1.0.0
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2022-08-04 09:08:04 +00:00
|
|
|
(self: super: {
|
|
|
|
plugwise = super.plugwise.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.20.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "plugwise";
|
|
|
|
repo = "python-plugwise";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-Sk7L0JPwn7IXVl5GeERxrG/vrHXeNwUjW1mgm4g40Ng=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2021-09-10 01:59:36 +00:00
|
|
|
# Pinned due to API changes in 0.1.0
|
2022-02-25 10:51:03 +00:00
|
|
|
(mkOverride "poolsense" "0.0.8" "sha256-17MHrYRmqkH+1QLtgq2d6zaRtqvb9ju9dvPt9gB2xCc=")
|
2021-09-10 01:59:36 +00:00
|
|
|
|
2022-02-11 11:28:46 +00:00
|
|
|
# Pinned due to API changes >0.3.5.3
|
|
|
|
(self: super: {
|
|
|
|
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
|
|
|
|
2022-08-03 09:03:10 +00:00
|
|
|
(self: super: {
|
|
|
|
pyatmo = super.pyatmo.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "6.2.4";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jabesq";
|
|
|
|
repo = "pyatmo";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-VXkQByaNA02fwBO2yuf7w1ZF/oJwd/h21de1EQlCu2U=";
|
|
|
|
};
|
|
|
|
checkInputs = [ super.freezegun ];
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
# pyunifiprotect excludes pydantic==1.9.1
|
|
|
|
(self: super: {
|
|
|
|
pydantic = super.pydantic.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "1.9.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "samuelcolvin";
|
|
|
|
repo = "pydantic";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-C4WP8tiMRFmkDkQRrvP3yOSM2zN8pHJmX9cdANIckpM=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2022-08-07 22:32:09 +00:00
|
|
|
(self: super: {
|
|
|
|
pydeconz = super.pydeconz.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "102";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Kane610";
|
|
|
|
repo = "deconz";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-Dbhp/+xyyWhFcYp2VRnivn5d1JMR5hBctdArIzLKIjM=";
|
|
|
|
};
|
|
|
|
doCheck = false; # requires pytest-aiohttp>=1.0.0
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2022-06-03 11:47:55 +00:00
|
|
|
(self: super: {
|
|
|
|
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=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2022-08-03 09:03:10 +00:00
|
|
|
(self: super: {
|
|
|
|
pytradfri = super.pytradfri.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "9.0.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant-libs";
|
|
|
|
repo = "pytradfri";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-12ol+2CnoPfkxmDGJJAkoafHGpQuWC4lh0N7lSvx2DE=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
(self: super: {
|
|
|
|
solax = super.solax.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.2.9";
|
|
|
|
src = super.fetchPypi {
|
|
|
|
pname = "solax";
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-5m2wxdTshAsEfldPAyXqAYYtH1VjqERRBUGzX6pV85I=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
(self: super: {
|
|
|
|
pysoma = super.pysoma.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.0.10";
|
|
|
|
src = super.fetchPypi {
|
|
|
|
pname = "pysoma";
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-sU1qHbAjdIUu0etjate8+U1zvunbw3ddBtDVUU10CuE=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2021-12-11 19:59:08 +00:00
|
|
|
# Pinned due to API changes in 0.4.0
|
|
|
|
(self: super: {
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
# Pinned due to API changes ~1.0
|
|
|
|
(self: super: {
|
|
|
|
vultr = super.vultr.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.1.2";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "spry-group";
|
|
|
|
repo = "python-vultr";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1qjvvr2v9gfnwskdl0ayazpcmiyw9zlgnijnhgq9mcri5gq9jw5h";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2021-06-15 13:28:31 +00:00
|
|
|
# home-assistant-frontend does not exist in python3.pkgs
|
2018-08-21 00:27:55 +00:00
|
|
|
(self: super: {
|
2021-06-15 13:28:31 +00:00
|
|
|
home-assistant-frontend = self.callPackage ./frontend.nix { };
|
2018-08-21 00:27:55 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-02-25 10:51:03 +00:00
|
|
|
mkOverride = attrName: version: hash:
|
2018-08-21 00:27:55 +00:00
|
|
|
self: super: {
|
2022-02-11 11:28:46 +00:00
|
|
|
${attrName} = super.${attrName}.overridePythonAttrs (oldAttrs: {
|
2018-08-21 00:27:55 +00:00
|
|
|
inherit version;
|
2018-05-11 17:39:37 +00:00
|
|
|
src = oldAttrs.src.override {
|
2022-02-25 10:51:03 +00:00
|
|
|
inherit version hash;
|
2018-05-11 17:39:37 +00:00
|
|
|
};
|
|
|
|
});
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
2019-07-25 09:51:55 +00:00
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
python = python3.override {
|
2018-08-21 00:27:55 +00:00
|
|
|
# Put packageOverrides at the start so they are applied after defaultOverrides
|
|
|
|
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ packageOverrides ] ++ defaultOverrides);
|
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
|
|
|
|
2022-02-14 00:48:09 +00:00
|
|
|
# Create info about included packages and components
|
|
|
|
extraComponentsFile = writeText "home-assistant-components" (lib.concatStringsSep "\n" extraComponents);
|
|
|
|
extraPackagesFile = writeText "home-assistant-packages" (lib.concatMapStringsSep "\n" (pkg: pkg.pname) extraBuildInputs);
|
|
|
|
|
2018-02-01 12:42:07 +00:00
|
|
|
# Don't forget to run parse-requirements.py after updating
|
2022-08-10 08:37:30 +00:00
|
|
|
hassVersion = "2022.8.3";
|
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
|
2022-02-02 20:53:50 +00:00
|
|
|
disabled = python.pythonOlder "3.9";
|
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;
|
|
|
|
|
2018-01-14 21:26:52 +00:00
|
|
|
# PyPI tarball is missing tests/ directory
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant";
|
2020-05-20 21:41:42 +00:00
|
|
|
repo = "core";
|
2018-01-14 21:26:52 +00:00
|
|
|
rev = version;
|
2022-08-10 08:37:30 +00:00
|
|
|
hash = "sha256-Wx5l51+vcByOqdwqcnOn1+yYgp98kXggRmgO/wtiI+U=";
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
ffmpeg = "${lib.getBin ffmpeg}/bin/ffmpeg";
|
|
|
|
})
|
2022-07-06 21:09:18 +00:00
|
|
|
./patches/wilight-import.patch
|
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 = [
|
|
|
|
"attrs"
|
|
|
|
"awesomeversion"
|
|
|
|
"bcrypt"
|
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"
|
2022-06-01 15:13:09 +00:00
|
|
|
"PyJWT"
|
2022-06-27 10:14:59 +00:00
|
|
|
"requests"
|
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; [
|
2021-06-15 19:16:08 +00:00
|
|
|
# Only packages required in setup.py
|
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
|
|
|
|
pyjwt
|
|
|
|
python-slugify
|
|
|
|
pyyaml
|
|
|
|
requests
|
|
|
|
voluptuous
|
|
|
|
voluptuous-serialize
|
|
|
|
yarl
|
2021-06-27 16:38:36 +00:00
|
|
|
# Not in setup.py, but used in homeassistant/util/package.py
|
|
|
|
setuptools
|
2022-03-05 01:21:30 +00:00
|
|
|
# Not in setup.py, but uncounditionally imported via tests/conftest.py
|
|
|
|
paho-mqtt
|
2018-02-01 12:42:07 +00:00
|
|
|
] ++ componentBuildInputs ++ extraBuildInputs;
|
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;
|
|
|
|
|
2022-01-15 00:20:08 +00:00
|
|
|
checkInputs = 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
|
2021-02-04 16:36:21 +00:00
|
|
|
pytest-aiohttp
|
2021-11-03 21:28:03 +00:00
|
|
|
pytest-freezegun
|
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
|
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
|
2021-05-10 19:25:43 +00:00
|
|
|
# required by tests/auth/mfa_modules
|
|
|
|
pyotp
|
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"
|
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"
|
2021-08-06 20:53:16 +00:00
|
|
|
# helpers/test_system_info.py: AssertionError: assert 'Unknown' == 'Home Assistant Container'
|
|
|
|
"--deselect tests/helpers/test_system_info.py::test_container_installationtype"
|
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"
|
|
|
|
# pyotp since v2.4.0 complains about the short mock keys, hass pins v2.3.0
|
|
|
|
"tests/auth/mfa_modules/test_notify.py"
|
|
|
|
];
|
|
|
|
|
2020-10-07 23:27:42 +00:00
|
|
|
disabledTests = [
|
2021-02-05 16:07:53 +00:00
|
|
|
# AssertionError: assert 1 == 0
|
|
|
|
"test_merge"
|
2022-01-14 00:17:59 +00:00
|
|
|
# Tests are flaky
|
|
|
|
"test_config_platform_valid"
|
2022-04-06 17:12:44 +00:00
|
|
|
# Test requires pylint>=2.13.0
|
|
|
|
"test_invalid_discovery_info"
|
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
|
|
|
'';
|
|
|
|
|
2022-02-14 00:48:09 +00:00
|
|
|
postInstall = ''
|
|
|
|
cp -v ${extraComponentsFile} $out/extra_components
|
|
|
|
cp -v ${extraPackagesFile} $out/extra_packages
|
|
|
|
'';
|
|
|
|
|
2020-05-06 06:39:44 +00:00
|
|
|
passthru = {
|
2022-01-15 00:20:08 +00:00
|
|
|
inherit
|
|
|
|
availableComponents
|
|
|
|
extraComponents
|
|
|
|
getPackages
|
|
|
|
python
|
|
|
|
supportedComponentsWithTests;
|
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 { };
|
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
|
|
|
};
|
|
|
|
}
|