From 191fb818e61d3d3682bccaa9a867f082396488dc Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 1 Feb 2022 21:03:51 +0100 Subject: [PATCH] nixos/tests/home-assistant: test module-based package loading Passing psycopg2 for PostgreSQL support in the recorder component is one of the more popular use cases to pass an extra package. --- nixos/tests/home-assistant.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nixos/tests/home-assistant.nix b/nixos/tests/home-assistant.nix index 3675d75b1359..6b37b8f8bf98 100644 --- a/nixos/tests/home-assistant.nix +++ b/nixos/tests/home-assistant.nix @@ -23,6 +23,17 @@ in { } ]; }; + services.postgresql = { + enable = true; + ensureDatabases = [ "hass" ]; + ensureUsers = [{ + name = "hass"; + ensurePermissions = { + "DATABASE hass" = "ALL PRIVILEGES"; + }; + }]; + }; + services.home-assistant = { enable = true; inherit configDir; @@ -39,6 +50,11 @@ in { "wake_on_lan" ]; + # test extra package passing from the module + extraPackages = python3Packages: with python3Packages; [ + psycopg2 + ]; + config = { homeassistant = { name = "Home"; @@ -48,6 +64,9 @@ in { elevation = 0; }; + # configure the recorder component to use the postgresql db + recorder.db_url = "postgresql://@/hass"; + # we can't load default_config, because the updater requires # network access and would cause an error, so load frontend # here explicitly.