about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2022-02-01 21:03:51 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2022-02-15 23:41:50 +0100
commit191fb818e61d3d3682bccaa9a867f082396488dc (patch)
tree8e3916589b1cad4d58422771748ef4b045c5cde6
parent918100f48f76152fbfcf20689af33288067d1122 (diff)
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.
-rw-r--r--nixos/tests/home-assistant.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/tests/home-assistant.nix b/nixos/tests/home-assistant.nix
index 3675d75b13597..6b37b8f8bf985 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.