nixos/home-assistant: support for secrets
This commit is contained in:
parent
b2dbc1edd1
commit
283e3e7218
|
@ -11,6 +11,9 @@ let
|
||||||
(recursiveUpdate defaultConfig cfg.config) else cfg.config));
|
(recursiveUpdate defaultConfig cfg.config) else cfg.config));
|
||||||
configFile = pkgs.runCommand "configuration.yaml" { preferLocalBuild = true; } ''
|
configFile = pkgs.runCommand "configuration.yaml" { preferLocalBuild = true; } ''
|
||||||
${pkgs.remarshal}/bin/json2yaml -i ${configJSON} -o $out
|
${pkgs.remarshal}/bin/json2yaml -i ${configJSON} -o $out
|
||||||
|
# Hack to support secrets, that are encoded as custom yaml objects,
|
||||||
|
# https://www.home-assistant.io/docs/configuration/secrets/
|
||||||
|
sed -i -e "s/'\!secret \(.*\)'/\!secret \1/" $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
lovelaceConfigJSON = pkgs.writeText "ui-lovelace.json"
|
lovelaceConfigJSON = pkgs.writeText "ui-lovelace.json"
|
||||||
|
@ -98,6 +101,10 @@ in {
|
||||||
{
|
{
|
||||||
homeassistant = {
|
homeassistant = {
|
||||||
name = "Home";
|
name = "Home";
|
||||||
|
latitude = "!secret latitude";
|
||||||
|
longitude = "!secret longitude";
|
||||||
|
elevation = "!secret elevation";
|
||||||
|
unit_system = "metric";
|
||||||
time_zone = "UTC";
|
time_zone = "UTC";
|
||||||
};
|
};
|
||||||
frontend = { };
|
frontend = { };
|
||||||
|
@ -108,6 +115,8 @@ in {
|
||||||
description = ''
|
description = ''
|
||||||
Your <filename>configuration.yaml</filename> as a Nix attribute set.
|
Your <filename>configuration.yaml</filename> as a Nix attribute set.
|
||||||
Beware that setting this option will delete your previous <filename>configuration.yaml</filename>.
|
Beware that setting this option will delete your previous <filename>configuration.yaml</filename>.
|
||||||
|
<link xlink:href="https://www.home-assistant.io/docs/configuration/secrets/">Secrets</link>
|
||||||
|
are encoded as strings as shown in the example.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue