-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
home-assistant: init at 0.62.1 #34188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ab02f54
astral: init at 1.4
flokli 9d39268
pythonPackages.pytest-aiohttp: init at 0.3.0
c68a165
pythonPackages.aiohttp: remove name attribute
6a2ead5
Add f-breidenstein as maintainer
fleaz 5bf6d94
home-assistant: init at 0.62.1
bacbc48
home-assistant: add NixOS module
0604c07
home-assistant: add NixOS test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| { config, lib, pkgs, ... }: | ||
|
|
||
| with lib; | ||
|
|
||
| let | ||
| cfg = config.services.home-assistant; | ||
|
|
||
| configFile = pkgs.writeText "configuration.yaml" (builtins.toJSON cfg.config); | ||
| in { | ||
| meta.maintainers = with maintainers; [ dotlambda ]; | ||
|
|
||
| options.services.home-assistant = { | ||
| enable = mkEnableOption "Home Assistant"; | ||
|
|
||
| configDir = mkOption { | ||
| default = "/var/lib/hass"; | ||
| type = types.path; | ||
| description = "The config directory, where your <filename>configuration.yaml</filename> is located."; | ||
| }; | ||
|
|
||
| config = mkOption { | ||
| default = null; | ||
| type = with types; nullOr attrs; | ||
| example = literalExample '' | ||
| { | ||
| homeassistant = { | ||
| name = "Home"; | ||
| time_zone = "UTC"; | ||
| }; | ||
| frontend = { }; | ||
| http = { }; | ||
| } | ||
| ''; | ||
| description = '' | ||
| Your <filename>configuration.yaml</filename> as a Nix attribute set. | ||
| Beware that setting this option will delete your previous <filename>configuration.yaml</filename>. | ||
| ''; | ||
| }; | ||
|
|
||
| package = mkOption { | ||
| default = pkgs.home-assistant; | ||
| defaultText = "pkgs.home-assistant"; | ||
| type = types.package; | ||
| example = literalExample '' | ||
| pkgs.home-assistant.override { | ||
| extraPackages = ps: with ps; [ colorlog ]; | ||
| } | ||
| ''; | ||
| description = '' | ||
| Home Assistant package to use. | ||
| Most Home Assistant components require additional dependencies, | ||
| which are best specified by overriding <literal>pkgs.home-assistant</literal>. | ||
| You can find the dependencies by searching for failed imports in your log or by looking at this list: | ||
| <link xlink:href="https://github.com/home-assistant/home-assistant/blob/master/requirements_all.txt"/> | ||
| ''; | ||
| }; | ||
| }; | ||
|
|
||
| config = mkIf cfg.enable { | ||
| systemd.services.home-assistant = { | ||
| description = "Home Assistant"; | ||
| wantedBy = [ "multi-user.target" ]; | ||
| after = [ "network.target" ]; | ||
| preStart = lib.optionalString (cfg.config != null) '' | ||
| rm -f ${cfg.configDir}/configuration.yaml | ||
| ln -s ${configFile} ${cfg.configDir}/configuration.yaml | ||
| ''; | ||
| serviceConfig = { | ||
| ExecStart = '' | ||
| ${cfg.package}/bin/hass --config "${cfg.configDir}" | ||
| ''; | ||
| User = "hass"; | ||
| Group = "hass"; | ||
| Restart = "on-failure"; | ||
| ProtectSystem = "strict"; | ||
| ReadWritePaths = "${cfg.configDir}"; | ||
| PrivateTmp = true; | ||
| }; | ||
| }; | ||
|
|
||
| users.extraUsers.hass = { | ||
| home = cfg.configDir; | ||
| createHome = true; | ||
| group = "hass"; | ||
| uid = config.ids.uids.hass; | ||
| }; | ||
|
|
||
| users.extraGroups.hass.gid = config.ids.gids.hass; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import ./make-test.nix ({ pkgs, ... }: | ||
|
|
||
| let | ||
| configDir = "/var/lib/foobar"; | ||
|
|
||
| in { | ||
| name = "home-assistant"; | ||
|
|
||
| nodes = { | ||
| hass = | ||
| { config, pkgs, ... }: | ||
| { | ||
| services.home-assistant = { | ||
| inherit configDir; | ||
| enable = true; | ||
| config = { | ||
| homeassistant = { | ||
| name = "Home"; | ||
| time_zone = "UTC"; | ||
| }; | ||
| frontend = { }; | ||
| http = { }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| testScript = '' | ||
| startAll; | ||
| $hass->waitForUnit("home-assistant.service"); | ||
|
|
||
| # Since config is specified using a Nix attribute set, | ||
| # configuration.yaml is a link to the Nix store | ||
| $hass->succeed("test -L ${configDir}/configuration.yaml"); | ||
|
|
||
| # Check that Home Assistant's web interface and API can be reached | ||
| $hass->waitForOpenPort(8123); | ||
| $hass->succeed("curl --fail http://localhost:8123/states"); | ||
| $hass->succeed("curl --fail http://localhost:8123/api/ | grep 'API running'"); | ||
| ''; | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { stdenv, buildPythonPackage, fetchPypi, pytz, pytest }: | ||
|
|
||
| buildPythonPackage rec { | ||
| pname = "astral"; | ||
| version = "1.4"; | ||
|
|
||
| src = fetchPypi { | ||
| inherit pname version; | ||
| extension = "zip"; | ||
| sha256 = "1zm1ypc6w279gh7lbgsfbzfxk2x4gihlq3rfh59hj70hmhjwiwp7"; | ||
| }; | ||
|
|
||
| propagatedBuildInputs = [ pytz ]; | ||
|
|
||
| checkInputs = [ pytest ]; | ||
| checkPhase = '' | ||
| py.test -k "not test_GoogleLocator" | ||
| ''; | ||
|
|
||
| meta = with stdenv.lib; { | ||
| description = "Calculations for the position of the sun and the moon"; | ||
| homepage = https://github.com/sffjunkie/astral/; | ||
| license = licenses.asl20; | ||
| maintainers = with maintainers; [ flokli ]; | ||
| }; | ||
| } |
20 changes: 20 additions & 0 deletions
20
pkgs/development/python-modules/pytest-aiohttp/default.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { stdenv, buildPythonPackage, fetchPypi, pytest, aiohttp }: | ||
|
|
||
| buildPythonPackage rec { | ||
| pname = "pytest-aiohttp"; | ||
| version = "0.3.0"; | ||
|
|
||
| src = fetchPypi { | ||
| inherit pname version; | ||
| sha256 = "0kx4mbs9bflycd8x9af0idcjhdgnzri3nw1qb0vpfyb3751qaaf9"; | ||
| }; | ||
|
|
||
| propagatedBuildInputs = [ pytest aiohttp ]; | ||
|
|
||
| meta = with stdenv.lib; { | ||
| homepage = https://github.com/aio-libs/pytest-aiohttp/; | ||
| description = "Pytest plugin for aiohttp support"; | ||
| license = licenses.asl20; | ||
| maintainers = with maintainers; [ dotlambda ]; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| { stdenv, fetchFromGitHub, python3 | ||
| , extraPackages ? ps: [] | ||
| , skipPip ? true }: | ||
|
|
||
| let | ||
|
|
||
| py = python3.override { | ||
| packageOverrides = self: super: { | ||
| yarl = super.yarl.overridePythonAttrs (oldAttrs: rec { | ||
| version = "0.18.0"; | ||
| src = oldAttrs.src.override { | ||
| inherit version; | ||
| sha256 = "11j8symkxh0ngvpddqpj85qmk6p70p20jca3alxc181gk3vx785s"; | ||
| }; | ||
| }); | ||
| aiohttp = super.aiohttp.overridePythonAttrs (oldAttrs: rec { | ||
| version = "2.3.7"; | ||
| src = oldAttrs.src.override { | ||
| inherit version; | ||
| sha256 = "0fzfpx5ny7559xrxaawnylq20dvrkjiag0ypcd13frwwivrlsagy"; | ||
| }; | ||
| }); | ||
| hass-frontend = super.callPackage ./frontend.nix { }; | ||
| }; | ||
| }; | ||
|
|
||
| # Ensure that we are using a consistent package set | ||
| extraBuildInputs = extraPackages py.pkgs; | ||
|
|
||
| in with py.pkgs; buildPythonApplication rec { | ||
| pname = "homeassistant"; | ||
| version = "0.62.1"; | ||
|
|
||
| diabled = !isPy3k; | ||
|
|
||
| # PyPI tarball is missing tests/ directory | ||
| src = fetchFromGitHub { | ||
| owner = "home-assistant"; | ||
| repo = "home-assistant"; | ||
| rev = version; | ||
| sha256 = "0151prwk2ci6bih0mdmc3r328nrvazn9jwk0w26wmd4cpvnb5h26"; | ||
| }; | ||
|
|
||
| propagatedBuildInputs = [ | ||
| # From setup.py | ||
| requests pyyaml pytz pip jinja2 voluptuous typing aiohttp yarl async-timeout chardet astral certifi | ||
| # From the components that are part of the default configuration.yaml | ||
| sqlalchemy aiohttp-cors hass-frontend user-agents distro mutagen xmltodict netdisco | ||
| ] ++ extraBuildInputs; | ||
|
|
||
| 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 | ||
| ''; | ||
|
|
||
| makeWrapperArgs = [] ++ stdenv.lib.optional skipPip [ "--add-flags --skip-pip" ]; | ||
|
|
||
| meta = with stdenv.lib; { | ||
| homepage = https://home-assistant.io/; | ||
| description = "Open-source home automation platform running on Python 3"; | ||
| license = licenses.asl20; | ||
| maintainers = with maintainers; [ f-breidenstein dotlambda ]; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { stdenv, fetchPypi, buildPythonPackage }: | ||
|
|
||
| buildPythonPackage rec { | ||
| pname = "home-assistant-frontend"; | ||
| version = "20180130.0"; | ||
|
|
||
| src = fetchPypi { | ||
| inherit pname version; | ||
| sha256 = "0b9klisl7hh30rml8qlrp9gpz33z9b825pd1vxbck48k0s98z1zi"; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I'll remove it with the next update.