2018-02-10 23:19:19 +01:00
|
|
|
{ lib, fetchFromGitHub, python3
|
2018-02-01 13:42:07 +01:00
|
|
|
, extraComponents ? []
|
2018-01-14 22:26:52 +01:00
|
|
|
, extraPackages ? ps: []
|
|
|
|
, skipPip ? true }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
py = python3.override {
|
|
|
|
packageOverrides = self: super: {
|
|
|
|
aiohttp = super.aiohttp.overridePythonAttrs (oldAttrs: rec {
|
2018-03-14 18:48:50 +01:00
|
|
|
version = "3.0.6";
|
2018-01-14 22:26:52 +01:00
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
2018-03-14 18:48:50 +01:00
|
|
|
sha256 = "5b588d21b454aaeaf2debf3c4a37f0752fb91a5c15b621deca7e8c49316154fe";
|
2018-01-14 22:26:52 +01:00
|
|
|
};
|
|
|
|
});
|
2018-02-08 13:02:57 +01:00
|
|
|
pytest = super.pytest.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "3.3.1";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "14zbnbn53yvrpv79ch6n02myq9b4winjkaykzi356sfqb7f3d16g";
|
|
|
|
};
|
|
|
|
});
|
2018-02-19 13:04:36 +01:00
|
|
|
voluptuous = super.voluptuous.overridePythonAttrs (oldAttrs: rec {
|
2018-03-14 18:48:50 +01:00
|
|
|
version = "0.11.1";
|
2018-02-19 13:04:36 +01:00
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
2018-03-14 18:48:50 +01:00
|
|
|
sha256 = "af7315c9fa99e0bfd195a21106c82c81619b42f0bd9b6e287b797c6b6b6a9918";
|
2018-02-19 13:04:36 +01:00
|
|
|
};
|
|
|
|
});
|
2018-02-27 00:27:01 +01:00
|
|
|
astral = super.astral.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "1.5";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "527628fbfe90c1596c3950ff84ebd07ecc10c8fb1044c903a0519b5057700cb6";
|
|
|
|
};
|
|
|
|
});
|
2018-04-06 10:08:12 +02:00
|
|
|
async-timeout = super.async-timeout.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "2.0.0";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "c17d8ac2d735d59aa62737d76f2787a6c938f5a944ecf768a8c0ab70b0dea566";
|
|
|
|
};
|
|
|
|
});
|
2018-01-14 22:26:52 +01:00
|
|
|
hass-frontend = super.callPackage ./frontend.nix { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-01 13:42:07 +01:00
|
|
|
componentPackages = import ./component-packages.nix;
|
|
|
|
|
|
|
|
availableComponents = builtins.attrNames componentPackages.components;
|
|
|
|
|
|
|
|
getPackages = component: builtins.getAttr component componentPackages.components;
|
|
|
|
|
2018-04-08 13:21:52 +02:00
|
|
|
componentBuildInputs = lib.concatMap (component: getPackages component py.pkgs) extraComponents;
|
2018-02-01 13:42:07 +01:00
|
|
|
|
2018-01-14 22:26:52 +01:00
|
|
|
# Ensure that we are using a consistent package set
|
|
|
|
extraBuildInputs = extraPackages py.pkgs;
|
|
|
|
|
2018-02-01 13:42:07 +01:00
|
|
|
# Don't forget to run parse-requirements.py after updating
|
2018-03-14 18:48:50 +01:00
|
|
|
hassVersion = "0.65.5";
|
2018-02-01 13:42:07 +01:00
|
|
|
|
2018-01-14 22:26:52 +01:00
|
|
|
in with py.pkgs; buildPythonApplication rec {
|
|
|
|
pname = "homeassistant";
|
2018-02-01 13:42:07 +01:00
|
|
|
version = assert (componentPackages.version == hassVersion); hassVersion;
|
2018-01-14 22:26:52 +01:00
|
|
|
|
2018-03-14 18:48:50 +01:00
|
|
|
disabled = pythonOlder "3.5";
|
|
|
|
|
2018-02-01 13:42:07 +01:00
|
|
|
inherit availableComponents;
|
2018-01-14 22:26:52 +01:00
|
|
|
|
|
|
|
# PyPI tarball is missing tests/ directory
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant";
|
|
|
|
repo = "home-assistant";
|
|
|
|
rev = version;
|
2018-03-14 18:48:50 +01:00
|
|
|
sha256 = "1jd44y3f31926g08h2zykp9hnigh6yms38mqn3i5gcl01n1n368k";
|
2018-01-14 22:26:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
# From setup.py
|
2018-03-14 18:48:50 +01:00
|
|
|
requests pyyaml pytz pip jinja2 voluptuous typing aiohttp async-timeout astral certifi attrs
|
2018-02-10 13:43:05 +01:00
|
|
|
# From http, frontend and recorder components
|
2018-03-14 18:48:50 +01:00
|
|
|
sqlalchemy aiohttp-cors hass-frontend
|
2018-02-01 13:42:07 +01:00
|
|
|
] ++ componentBuildInputs ++ extraBuildInputs;
|
2018-01-14 22:26:52 +01:00
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytest requests-mock pydispatcher pytest-aiohttp
|
|
|
|
];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
# The components' dependencies are not included, so they cannot be tested
|
|
|
|
py.test --ignore tests/components
|
|
|
|
# Some basic components should be tested however
|
|
|
|
py.test \
|
|
|
|
tests/components/{group,http} \
|
|
|
|
tests/components/test_{api,configurator,demo,discovery,frontend,init,introduction,logger,script,shell_command,system_log,websocket_api}.py
|
|
|
|
'';
|
|
|
|
|
2018-02-10 23:19:19 +01:00
|
|
|
makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip";
|
2018-01-14 22:26:52 +01:00
|
|
|
|
2018-02-10 23:19:19 +01:00
|
|
|
meta = with lib; {
|
2018-01-14 22:26:52 +01:00
|
|
|
homepage = https://home-assistant.io/;
|
|
|
|
description = "Open-source home automation platform running on Python 3";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ f-breidenstein dotlambda ];
|
|
|
|
};
|
|
|
|
}
|