2018-02-10 22:19:19 +00:00
|
|
|
{ lib, fetchFromGitHub, python3
|
2018-02-01 12:42:07 +00:00
|
|
|
, extraComponents ? []
|
2018-01-14 21:26:52 +00:00
|
|
|
, extraPackages ? ps: []
|
|
|
|
, skipPip ? true }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
py = python3.override {
|
2018-06-26 20:36:14 +00:00
|
|
|
# Override the version of some packages pinned in Home Assistant's setup.py
|
2018-01-14 21:26:52 +00:00
|
|
|
packageOverrides = self: super: {
|
2018-06-26 20:36:14 +00:00
|
|
|
aiohttp = super.aiohttp.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "3.3.2";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "f20deec7a3fbaec7b5eb7ad99878427ad2ee4cc16a46732b705e8121cbb3cc12";
|
|
|
|
};
|
|
|
|
});
|
2018-06-24 14:56:45 +00:00
|
|
|
requests = super.requests.overridePythonAttrs (oldAttrs: rec {
|
2018-07-07 19:03:33 +00:00
|
|
|
version = "2.19.1";
|
2018-01-14 21:26:52 +00:00
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
2018-07-07 19:03:33 +00:00
|
|
|
sha256 = "ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a";
|
2018-02-08 12:02:57 +00:00
|
|
|
};
|
|
|
|
});
|
2018-02-19 12:04:36 +00:00
|
|
|
voluptuous = super.voluptuous.overridePythonAttrs (oldAttrs: rec {
|
2018-03-14 17:48:50 +00:00
|
|
|
version = "0.11.1";
|
2018-02-19 12:04:36 +00:00
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
2018-03-14 17:48:50 +00:00
|
|
|
sha256 = "af7315c9fa99e0bfd195a21106c82c81619b42f0bd9b6e287b797c6b6b6a9918";
|
2018-02-19 12:04:36 +00:00
|
|
|
};
|
|
|
|
});
|
2018-05-11 17:39:37 +00:00
|
|
|
attrs = super.attrs.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "18.1.0";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "e0d0eb91441a3b53dab4d9b743eafc1ac44476296a2053b6ca3af0b139faf87b";
|
|
|
|
};
|
|
|
|
});
|
2018-02-26 23:27:01 +00:00
|
|
|
astral = super.astral.overridePythonAttrs (oldAttrs: rec {
|
2018-05-11 17:39:37 +00:00
|
|
|
version = "1.6.1";
|
2018-02-26 23:27:01 +00:00
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
2018-05-11 17:39:37 +00:00
|
|
|
sha256 = "ab0c08f2467d35fcaeb7bad15274743d3ac1ad18b5391f64a0058a9cd192d37d";
|
2018-02-26 23:27:01 +00:00
|
|
|
};
|
|
|
|
});
|
2018-05-11 17:39:37 +00:00
|
|
|
# used by check_config script
|
|
|
|
# can be unpinned once https://github.com/home-assistant/home-assistant/issues/11917 is resolved
|
|
|
|
colorlog = super.colorlog.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "3.1.4";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "418db638c9577f37f0fae4914074f395847a728158a011be2a193ac491b9779d";
|
|
|
|
};
|
|
|
|
});
|
2018-01-14 21:26:52 +00:00
|
|
|
hass-frontend = super.callPackage ./frontend.nix { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-01 12:42:07 +00:00
|
|
|
componentPackages = import ./component-packages.nix;
|
|
|
|
|
|
|
|
availableComponents = builtins.attrNames componentPackages.components;
|
|
|
|
|
|
|
|
getPackages = component: builtins.getAttr component componentPackages.components;
|
|
|
|
|
2018-04-08 11:21:52 +00:00
|
|
|
componentBuildInputs = lib.concatMap (component: getPackages component py.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
|
|
|
|
extraBuildInputs = extraPackages py.pkgs;
|
|
|
|
|
2018-02-01 12:42:07 +00:00
|
|
|
# Don't forget to run parse-requirements.py after updating
|
2018-07-17 12:32:38 +00:00
|
|
|
hassVersion = "0.73.2";
|
2018-02-01 12:42:07 +00:00
|
|
|
|
2018-01-14 21:26:52 +00:00
|
|
|
in with py.pkgs; buildPythonApplication rec {
|
|
|
|
pname = "homeassistant";
|
2018-02-01 12:42:07 +00:00
|
|
|
version = assert (componentPackages.version == hassVersion); hassVersion;
|
2018-01-14 21:26:52 +00:00
|
|
|
|
2018-03-14 17:48:50 +00:00
|
|
|
disabled = pythonOlder "3.5";
|
|
|
|
|
2018-02-01 12:42:07 +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-07-17 12:32:38 +00:00
|
|
|
sha256 = "1hfxwm49hgikdh827jnlzgfz9h51rjz1gm841f5iz1vwz301l6sk";
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
# From setup.py
|
2018-03-14 17:48:50 +00:00
|
|
|
requests pyyaml pytz pip jinja2 voluptuous typing aiohttp async-timeout astral certifi attrs
|
2018-06-05 07:37:30 +00:00
|
|
|
# From http, frontend, recorder and config.config_entries components
|
|
|
|
sqlalchemy aiohttp-cors hass-frontend voluptuous-serialize
|
2018-02-01 12:42:07 +00:00
|
|
|
] ++ 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
|
2018-05-11 17:39:37 +00:00
|
|
|
py.test \
|
2018-06-26 20:36:14 +00:00
|
|
|
tests/components/{group,http,frontend} \
|
2018-06-24 14:56:45 +00:00
|
|
|
tests/components/test_{api,configurator,demo,discovery,init,introduction,logger,script,shell_command,system_log,websocket_api}.py
|
2018-01-14 21:26:52 +00:00
|
|
|
'';
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|