home-assistant: use remarshal to convert configuration to YAML
HA doesn't mind the configuration being JSON instead of YAML but since YAML is the official language, use that as it allows users to easily exchange config data with other parties in the community.
This commit is contained in:
parent
4cd88807d8
commit
b886faa6b6
@ -134,8 +134,10 @@ in {
|
||||
description = "Home Assistant";
|
||||
after = [ "network.target" ];
|
||||
preStart = lib.optionalString (cfg.config != null) ''
|
||||
rm -f ${cfg.configDir}/configuration.yaml
|
||||
ln -s ${configFile} ${cfg.configDir}/configuration.yaml
|
||||
config=${cfg.configDir}/configuration.yaml
|
||||
rm -f $config
|
||||
${pkgs.remarshal}/bin/json2yaml -i ${configFile} -o $config
|
||||
chmod 444 $config
|
||||
'';
|
||||
serviceConfig = {
|
||||
ExecStart = "${package}/bin/hass --config '${cfg.configDir}'";
|
||||
|
@ -51,9 +51,9 @@ in {
|
||||
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");
|
||||
# The config is specified using a Nix attribute set,
|
||||
# but then converted from JSON to YAML
|
||||
$hass->succeed("test -f ${configDir}/configuration.yaml");
|
||||
|
||||
# Check that Home Assistant's web interface and API can be reached
|
||||
$hass->waitForOpenPort(8123);
|
||||
|
Loading…
Reference in New Issue
Block a user