From 918100f48f76152fbfcf20689af33288067d1122 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 1 Feb 2022 21:25:12 +0100 Subject: [PATCH] nixos/home-assistant: Wait for {mysql,postgresql}.service Database provisioning was shown to be racy since adding a recorder test using PostgreSQL. There is no harm in waiting for these services, because if they're not available they will be ignored. --- nixos/modules/services/home-automation/home-assistant.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix index eb70cf4c9e29..15aea7de902d 100644 --- a/nixos/modules/services/home-automation/home-assistant.nix +++ b/nixos/modules/services/home-automation/home-assistant.nix @@ -364,7 +364,13 @@ in { systemd.services.home-assistant = { description = "Home Assistant"; - after = [ "network-online.target" ]; + after = [ + "network-online.target" + + # prevent races with database creation + "mysql.service" + "postgresql.service" + ]; preStart = optionalString (cfg.config != null) (if cfg.configWritable then '' cp --no-preserve=mode ${configFile} "${cfg.configDir}/configuration.yaml" '' else ''