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.
This commit is contained in:
Martin Weinelt 2022-02-01 21:03:51 +01:00
parent 918100f48f
commit 191fb818e6
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759

View File

@ -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.