diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2019-12-20 08:40:16 +0000 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2020-01-09 10:39:50 +0000 |
commit | 283e3e72185aeaf48447e10c5c1d3d577c83c5fa (patch) | |
tree | 6360f35801e9ec2021321ce2bbed849bf1d89a2a | |
parent | b2dbc1edd15753bfb7d9f67d8e5c0f2999e3fc95 (diff) | |
download | nixlib-283e3e72185aeaf48447e10c5c1d3d577c83c5fa.tar nixlib-283e3e72185aeaf48447e10c5c1d3d577c83c5fa.tar.gz nixlib-283e3e72185aeaf48447e10c5c1d3d577c83c5fa.tar.bz2 nixlib-283e3e72185aeaf48447e10c5c1d3d577c83c5fa.tar.lz nixlib-283e3e72185aeaf48447e10c5c1d3d577c83c5fa.tar.xz nixlib-283e3e72185aeaf48447e10c5c1d3d577c83c5fa.tar.zst nixlib-283e3e72185aeaf48447e10c5c1d3d577c83c5fa.zip |
nixos/home-assistant: support for secrets
-rw-r--r-- | nixos/modules/services/misc/home-assistant.nix | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/home-assistant.nix b/nixos/modules/services/misc/home-assistant.nix index 74702c97f551..cc113ca2d0c1 100644 --- a/nixos/modules/services/misc/home-assistant.nix +++ b/nixos/modules/services/misc/home-assistant.nix @@ -11,6 +11,9 @@ let (recursiveUpdate defaultConfig cfg.config) else cfg.config)); configFile = pkgs.runCommand "configuration.yaml" { preferLocalBuild = true; } '' ${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" @@ -98,6 +101,10 @@ in { { homeassistant = { name = "Home"; + latitude = "!secret latitude"; + longitude = "!secret longitude"; + elevation = "!secret elevation"; + unit_system = "metric"; time_zone = "UTC"; }; frontend = { }; @@ -108,6 +115,8 @@ in { description = '' Your <filename>configuration.yaml</filename> as a Nix attribute set. 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. ''; }; |