2018-12-12 14:01:39 +01:00
|
|
|
{ lib, fetchFromGitHub, fetchpatch, python3
|
2018-07-29 21:49:46 +02:00
|
|
|
|
|
|
|
# Look up dependencies of specified components in component-packages.nix
|
2018-02-01 13:42:07 +01:00
|
|
|
, extraComponents ? []
|
2018-07-29 21:49:46 +02:00
|
|
|
|
|
|
|
# Additional packages to add to propagatedBuildInputs
|
2018-01-14 22:26:52 +01:00
|
|
|
, extraPackages ? ps: []
|
2018-07-29 21:49:46 +02:00
|
|
|
|
2018-08-21 02:27:55 +02:00
|
|
|
# Override Python packages using
|
|
|
|
# self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); }
|
|
|
|
# Applied after defaultOverrides
|
|
|
|
, packageOverrides ? self: super: { }
|
|
|
|
|
2018-07-29 21:49:46 +02:00
|
|
|
# Skip pip install of required packages on startup
|
2018-01-14 22:26:52 +01:00
|
|
|
, skipPip ? true }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2018-08-21 02:27:55 +02:00
|
|
|
defaultOverrides = [
|
2018-06-26 22:36:14 +02:00
|
|
|
# Override the version of some packages pinned in Home Assistant's setup.py
|
2018-10-17 14:56:55 +02:00
|
|
|
(mkOverride "aiohttp" "3.4.4"
|
|
|
|
"51afec6ffa50a9da4cdef188971a802beb1ca8e8edb40fa429e5e529db3475fa")
|
2018-11-10 13:42:15 +01:00
|
|
|
(mkOverride "astral" "1.7.1"
|
|
|
|
"88086fd2006c946567285286464b2da3294a3b0cbba4410b7008ec2458f82a07")
|
2018-10-27 15:11:53 +02:00
|
|
|
(mkOverride "async-timeout" "3.0.1"
|
|
|
|
"0c3c816a028d47f659d6ff5c745cb2acf1f966da1fe5c19c77a70282b25f4c5f")
|
2018-10-17 14:56:55 +02:00
|
|
|
(mkOverride "attrs" "18.2.0"
|
|
|
|
"10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69")
|
2018-08-30 17:38:31 +02:00
|
|
|
(mkOverride "bcrypt" "3.1.4"
|
|
|
|
"67ed1a374c9155ec0840214ce804616de49c3df9c5bc66740687c1c9b1cd9e8d")
|
2018-08-21 02:27:55 +02:00
|
|
|
(mkOverride "pyjwt" "1.6.4"
|
|
|
|
"4ee413b357d53fd3fb44704577afac88e72e878716116270d722723d65b42176")
|
|
|
|
(mkOverride "cryptography" "2.3.1"
|
|
|
|
"8d10113ca826a4c29d5b85b2c4e045ffa8bad74fb525ee0eceb1d38d4c70dfd6")
|
|
|
|
(mkOverride "cryptography_vectors" "2.3.1" # required by cryptography==2.3.1
|
|
|
|
"bf4d9b61dce69c49e830950aa36fad194706463b0b6dfe81425b9e0bc6644d46")
|
2018-11-29 12:10:43 +01:00
|
|
|
(mkOverride "requests" "2.20.1"
|
|
|
|
"ea881206e59f41dbd0bd445437d792e43906703fff75ca8ff43ccdb11f33f263")
|
2018-12-13 17:25:12 +01:00
|
|
|
(mkOverride "ruamel_yaml" "0.15.80"
|
|
|
|
"4f203351575dba0829c7b1e5d376d08cf5f58e4a2b844e8ce552b3e41cd414e6")
|
2018-08-21 02:27:55 +02:00
|
|
|
(mkOverride "voluptuous" "0.11.5"
|
|
|
|
"567a56286ef82a9d7ae0628c5842f65f516abcb496e74f3f59f1d7b28df314ef")
|
2018-10-17 14:56:55 +02:00
|
|
|
(mkOverride "voluptuous-serialize" "2.0.0"
|
|
|
|
"44be04d87aec34bd7d31ab539341fadc505205f2299031ed9be985112c21aa41")
|
2018-08-21 02:27:55 +02:00
|
|
|
|
2018-11-10 13:42:15 +01:00
|
|
|
# used by auth.mfa_modules.totp
|
|
|
|
(mkOverride "pyotp" "2.2.6"
|
|
|
|
"dd9130dd91a0340d89a0f06f887dbd76dd07fb95a8886dc4bc401239f2eebd69")
|
|
|
|
|
2018-08-21 02:27:55 +02:00
|
|
|
# used by check_config script
|
|
|
|
# can be unpinned once https://github.com/home-assistant/home-assistant/issues/11917 is resolved
|
|
|
|
(mkOverride "colorlog" "3.1.4"
|
|
|
|
"418db638c9577f37f0fae4914074f395847a728158a011be2a193ac491b9779d")
|
|
|
|
|
2018-12-12 14:01:39 +01:00
|
|
|
# hass-frontend does not exist in python3.pkgs
|
2018-08-21 02:27:55 +02: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 19:39:37 +02:00
|
|
|
src = oldAttrs.src.override {
|
2018-08-21 02:27:55 +02:00
|
|
|
inherit version sha256;
|
2018-05-11 19:39:37 +02:00
|
|
|
};
|
|
|
|
});
|
2018-01-14 22:26:52 +01:00
|
|
|
};
|
2018-08-21 02:27:55 +02:00
|
|
|
|
2018-12-12 14:01:39 +01:00
|
|
|
py = python3.override {
|
2018-08-21 02:27:55 +02:00
|
|
|
# Put packageOverrides at the start so they are applied after defaultOverrides
|
|
|
|
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ packageOverrides ] ++ defaultOverrides);
|
2018-01-14 22:26:52 +01:00
|
|
|
};
|
|
|
|
|
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-12-22 12:00:06 +01:00
|
|
|
hassVersion = "0.84.6";
|
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-12-22 12:00:06 +01:00
|
|
|
sha256 = "142hxsvhb9lh77h54975vkvl1fx5lslrydq1vbqyy51dy85ms8lc";
|
2018-01-14 22:26:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
# From setup.py
|
2018-11-10 13:42:15 +01:00
|
|
|
aiohttp astral async-timeout attrs bcrypt certifi jinja2 pyjwt cryptography pip pytz pyyaml requests ruamel_yaml voluptuous voluptuous-serialize
|
2018-10-17 14:56:55 +02:00
|
|
|
# From http, frontend and recorder components and auth.mfa_modules.totp
|
|
|
|
sqlalchemy aiohttp-cors hass-frontend pyotp pyqrcode
|
2018-02-01 13:42:07 +01:00
|
|
|
] ++ componentBuildInputs ++ extraBuildInputs;
|
2018-01-14 22:26:52 +01:00
|
|
|
|
|
|
|
checkInputs = [
|
2018-12-13 17:25:12 +01:00
|
|
|
asynctest pytest pytest-aiohttp requests-mock pydispatcher
|
2018-01-14 22:26:52 +01: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 19:39:37 +02:00
|
|
|
py.test \
|
2018-10-17 14:56:55 +02:00
|
|
|
tests/components/{group,http,frontend,config,websocket_api} \
|
|
|
|
tests/components/test_{api,configurator,demo,discovery,init,introduction,logger,script,shell_command,system_log}.py
|
2018-01-14 22:26:52 +01:00
|
|
|
'';
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|