nixpkgs/pkgs/servers/home-assistant/default.nix

99 lines
3.2 KiB
Nix
Raw Normal View History

2018-02-10 22:19:19 +00:00
{ lib, fetchFromGitHub, python3
, extraComponents ? []
2018-01-14 21:26:52 +00:00
, extraPackages ? ps: []
, skipPip ? true }:
let
py = python3.override {
packageOverrides = self: super: {
yarl = super.yarl.overridePythonAttrs (oldAttrs: rec {
2018-02-10 22:19:19 +00:00
version = "1.1.0";
2018-01-14 21:26:52 +00:00
src = oldAttrs.src.override {
inherit version;
2018-02-10 22:19:19 +00:00
sha256 = "162630v7f98l27h11msk9416lqwm2mpgxh4s636594nlbfs9by3a";
2018-01-14 21:26:52 +00:00
};
});
aiohttp = super.aiohttp.overridePythonAttrs (oldAttrs: rec {
2018-02-10 22:19:19 +00:00
version = "2.3.10";
2018-01-14 21:26:52 +00:00
src = oldAttrs.src.override {
inherit version;
2018-02-10 22:19:19 +00:00
sha256 = "8adda6583ba438a4c70693374e10b60168663ffa6564c5c75d3c7a9055290964";
2018-01-14 21:26:52 +00:00
};
});
pytest = super.pytest.overridePythonAttrs (oldAttrs: rec {
version = "3.3.1";
src = oldAttrs.src.override {
inherit version;
sha256 = "14zbnbn53yvrpv79ch6n02myq9b4winjkaykzi356sfqb7f3d16g";
};
});
2018-02-19 12:04:36 +00:00
voluptuous = super.voluptuous.overridePythonAttrs (oldAttrs: rec {
version = "0.10.5";
src = oldAttrs.src.override {
inherit version;
sha256 = "15i3gaap8ilhpbah1ffc6q415wkvliqxilc6s69a4rinvkw6cx3s";
};
});
2018-01-14 21:26:52 +00:00
hass-frontend = super.callPackage ./frontend.nix { };
};
};
componentPackages = import ./component-packages.nix;
availableComponents = builtins.attrNames componentPackages.components;
getPackages = component: builtins.getAttr component componentPackages.components;
componentBuildInputs = map (component: getPackages component py.pkgs) extraComponents;
2018-01-14 21:26:52 +00:00
# Ensure that we are using a consistent package set
extraBuildInputs = extraPackages py.pkgs;
# Don't forget to run parse-requirements.py after updating
2018-02-18 10:59:24 +00:00
hassVersion = "0.63.3";
2018-01-14 21:26:52 +00:00
in with py.pkgs; buildPythonApplication rec {
pname = "homeassistant";
version = assert (componentPackages.version == hassVersion); hassVersion;
2018-01-14 21:26:52 +00:00
inherit availableComponents;
2018-01-14 21:26:52 +00:00
# PyPI tarball is missing tests/ directory
src = fetchFromGitHub {
owner = "home-assistant";
repo = "home-assistant";
rev = version;
2018-02-18 10:59:24 +00:00
sha256 = "1lrdrn0x8i81vbqxziv5fgcc8ldz7x5r62kfz3nyg4g43rk3dqq8";
2018-01-14 21:26:52 +00:00
};
propagatedBuildInputs = [
# From setup.py
2018-02-12 17:15:29 +00:00
requests pyyaml pytz pip jinja2 voluptuous typing aiohttp yarl async-timeout chardet astral certifi attrs
# From http, frontend and recorder components
sqlalchemy aiohttp-cors hass-frontend user-agents
] ++ componentBuildInputs ++ extraBuildInputs;
2018-01-14 21:26:52 +00: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 22:19:19 +00:00
makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip";
2018-01-14 21:26:52 +00:00
2018-02-10 22:19:19 +00:00
meta = with lib; {
2018-01-14 21:26:52 +00: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 ];
};
}