2018-12-12 13:01:39 +00:00
|
|
|
{ lib, fetchFromGitHub, fetchpatch, python3
|
2018-07-29 19:49:46 +00:00
|
|
|
|
|
|
|
# Look up dependencies of specified components in component-packages.nix
|
2018-02-01 12:42:07 +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
|
|
|
|
2018-08-21 00:27:55 +00:00
|
|
|
# Override Python packages using
|
|
|
|
# self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); }
|
|
|
|
# Applied after defaultOverrides
|
|
|
|
, packageOverrides ? self: super: { }
|
|
|
|
|
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 = [
|
2018-06-26 20:36:14 +00:00
|
|
|
# Override the version of some packages pinned in Home Assistant's setup.py
|
2019-01-24 14:22:28 +00:00
|
|
|
(mkOverride "aiohttp" "3.5.4"
|
|
|
|
"9c4c83f4fa1938377da32bc2d59379025ceeee8e24b89f72fcbccd8ca22dc9bf")
|
2019-03-04 16:23:55 +00:00
|
|
|
(mkOverride "astral" "1.10.1"
|
|
|
|
"d2a67243c4503131c856cafb1b1276de52a86e5b8a1d507b7e08bee51cb67bf1")
|
2018-10-27 13:11:53 +00:00
|
|
|
(mkOverride "async-timeout" "3.0.1"
|
|
|
|
"0c3c816a028d47f659d6ff5c745cb2acf1f966da1fe5c19c77a70282b25f4c5f")
|
2018-10-17 12:56:55 +00:00
|
|
|
(mkOverride "attrs" "18.2.0"
|
|
|
|
"10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69")
|
2019-03-04 16:23:55 +00:00
|
|
|
(mkOverride "bcrypt" "3.1.6"
|
|
|
|
"44636759d222baa62806bbceb20e96f75a015a6381690d1bc2eda91c01ec02ea")
|
2019-02-14 13:29:48 +00:00
|
|
|
(self: super: {
|
|
|
|
pyjwt = super.pyjwt.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "1.6.4";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "4ee413b357d53fd3fb44704577afac88e72e878716116270d722723d65b42176";
|
|
|
|
};
|
|
|
|
doCheck = false; # https://github.com/jpadilla/pyjwt/issues/382
|
|
|
|
});
|
|
|
|
})
|
2019-03-04 16:23:55 +00:00
|
|
|
(mkOverride "cryptography" "2.5"
|
|
|
|
"00c4d7gvsymlaw0r13zrm32dcnarmpayjyrh65yymlmr6mrbcij9")
|
|
|
|
(mkOverride "cryptography_vectors" "2.5" # required by cryptography==2.5
|
|
|
|
"15qfl3pnw2f11r0z0zhwl56f6pb60ysav8fxmpnz5p80cfwljdik")
|
2019-01-10 10:25:16 +00:00
|
|
|
(mkOverride "python-slugify" "1.2.6"
|
|
|
|
"7723daf30996db26573176bddcdf5fcb98f66dc70df05c9cb29f2c79b8193245")
|
2019-03-24 18:45:35 +00:00
|
|
|
(mkOverride "pyyaml" "3.13"
|
|
|
|
"3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf")
|
2019-01-10 10:25:16 +00:00
|
|
|
(mkOverride "requests" "2.21.0"
|
|
|
|
"502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e")
|
2019-03-04 16:23:55 +00:00
|
|
|
(mkOverride "ruamel_yaml" "0.15.88"
|
|
|
|
"ac56193c47a31c9efa151064a9e921865cdad0f7a991d229e7197e12fe8e0cd7")
|
2018-08-21 00:27:55 +00:00
|
|
|
(mkOverride "voluptuous" "0.11.5"
|
|
|
|
"567a56286ef82a9d7ae0628c5842f65f516abcb496e74f3f59f1d7b28df314ef")
|
2019-03-04 16:23:55 +00:00
|
|
|
(mkOverride "voluptuous-serialize" "2.1.0"
|
|
|
|
"d30fef4f1aba251414ec0b315df81a06da7bf35201dcfb1f6db5253d738a154f")
|
2018-08-21 00:27:55 +00:00
|
|
|
|
2018-11-10 12:42:15 +00:00
|
|
|
# used by auth.mfa_modules.totp
|
|
|
|
(mkOverride "pyotp" "2.2.6"
|
|
|
|
"dd9130dd91a0340d89a0f06f887dbd76dd07fb95a8886dc4bc401239f2eebd69")
|
|
|
|
|
2018-08-21 00:27:55 +00:00
|
|
|
# used by check_config script
|
|
|
|
# can be unpinned once https://github.com/home-assistant/home-assistant/issues/11917 is resolved
|
2019-01-11 22:40:58 +00:00
|
|
|
(mkOverride "colorlog" "4.0.2"
|
|
|
|
"3cf31b25cbc8f86ec01fef582ef3b840950dea414084ed19ab922c8b493f9b42")
|
2018-08-21 00:27:55 +00:00
|
|
|
|
2018-12-12 13:01:39 +00:00
|
|
|
# hass-frontend does not exist in python3.pkgs
|
2018-08-21 00:27:55 +00:00
|
|
|
(self: super: {
|
|
|
|
hass-frontend = self.callPackage ./frontend.nix { };
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
mkOverride = attrname: version: sha256:
|
|
|
|
self: super: {
|
|
|
|
${attrname} = super.${attrname}.overridePythonAttrs (oldAttrs: {
|
|
|
|
inherit version;
|
2018-05-11 17:39:37 +00:00
|
|
|
src = oldAttrs.src.override {
|
2018-08-21 00:27:55 +00:00
|
|
|
inherit version sha256;
|
2018-05-11 17:39:37 +00:00
|
|
|
};
|
|
|
|
});
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
2018-08-21 00:27:55 +00:00
|
|
|
|
2018-12-12 13:01:39 +00:00
|
|
|
py = 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;
|
|
|
|
|
|
|
|
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
|
2019-03-24 18:45:35 +00:00
|
|
|
hassVersion = "0.90.1";
|
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;
|
2019-03-24 18:45:35 +00:00
|
|
|
sha256 = "1w8mbrzr760867a342jyihxbkx3i9pdsdxdv2ck15fy4axd3wbsh";
|
2018-01-14 21:26:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
# From setup.py
|
2019-01-10 10:25:16 +00:00
|
|
|
aiohttp astral async-timeout attrs bcrypt certifi jinja2 pyjwt cryptography pip
|
|
|
|
python-slugify pytz pyyaml requests ruamel_yaml voluptuous voluptuous-serialize
|
2018-10-17 12:56:55 +00:00
|
|
|
# From http, frontend and recorder components and auth.mfa_modules.totp
|
|
|
|
sqlalchemy aiohttp-cors hass-frontend pyotp pyqrcode
|
2018-02-01 12:42:07 +00:00
|
|
|
] ++ componentBuildInputs ++ extraBuildInputs;
|
2018-01-14 21:26:52 +00:00
|
|
|
|
|
|
|
checkInputs = [
|
2018-12-13 16:25:12 +00:00
|
|
|
asynctest pytest pytest-aiohttp requests-mock pydispatcher
|
2018-01-14 21:26:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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 \
|
2019-03-04 16:23:55 +00:00
|
|
|
tests/components/{api,config,configurator,demo,discovery,frontend,group,history,history_graph} \
|
|
|
|
tests/components/{http,init,introduction,logger,script,shell_command,system_log,websocket_api}
|
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 ];
|
|
|
|
};
|
|
|
|
}
|