forked from mirrors/nixpkgs
47 lines
1.1 KiB
Nix
47 lines
1.1 KiB
Nix
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";
|
|
latitude = "0.0";
|
|
longitude = "0.0";
|
|
elevation = 0;
|
|
};
|
|
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'");
|
|
|
|
$hass->fail("cat ${configDir}/home-assistant.log | grep -qF ERROR");
|
|
'';
|
|
})
|