about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2023-12-03 00:52:54 +0100
committerSandro Jäckel <sandro.jaeckel@gmail.com>2023-12-03 00:53:59 +0100
commit663dbfb82d631c8fcc4b6c46a4db3760a99e1c36 (patch)
treef6f04ea20b4d31a7e1d73e87b5f80386cb9d8d9f /nixos
parentab3ea20adfe05a2328b4991612912ef7db67af83 (diff)
downloadnixlib-663dbfb82d631c8fcc4b6c46a4db3760a99e1c36.tar
nixlib-663dbfb82d631c8fcc4b6c46a4db3760a99e1c36.tar.gz
nixlib-663dbfb82d631c8fcc4b6c46a4db3760a99e1c36.tar.bz2
nixlib-663dbfb82d631c8fcc4b6c46a4db3760a99e1c36.tar.lz
nixlib-663dbfb82d631c8fcc4b6c46a4db3760a99e1c36.tar.xz
nixlib-663dbfb82d631c8fcc4b6c46a4db3760a99e1c36.tar.zst
nixlib-663dbfb82d631c8fcc4b6c46a4db3760a99e1c36.zip
nixos/home-assistant: fix custom lovelace module loading
based on https://community.home-assistant.io/t/ui-lovelace-yaml-and-custom-resources/240178/4

Tested on a home-assistant server and before the card was not loaded at all.
After this it threw an error that my config is wrong.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/home-automation/home-assistant.nix6
1 files changed, 2 insertions, 4 deletions
diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix
index 54fd3e17292f..e1fe1d9f54cb 100644
--- a/nixos/modules/services/home-automation/home-assistant.nix
+++ b/nixos/modules/services/home-automation/home-assistant.nix
@@ -11,14 +11,12 @@ let
   # options shown in settings.
   # We post-process the result to add support for YAML functions, like secrets or includes, see e.g.
   # https://www.home-assistant.io/docs/configuration/secrets/
-  filteredConfig = lib.converge (lib.filterAttrsRecursive (_: v: ! elem v [ null ])) cfg.config or {};
+  filteredConfig = lib.converge (lib.filterAttrsRecursive (_: v: ! elem v [ null ])) (lib.recursiveUpdate customLovelaceModulesResources (cfg.config or {}));
   configFile = pkgs.runCommandLocal "configuration.yaml" { } ''
     cp ${format.generate "configuration.yaml" filteredConfig} $out
     sed -i -e "s/'\!\([a-z_]\+\) \(.*\)'/\!\1 \2/;s/^\!\!/\!/;" $out
   '';
-  lovelaceConfig = if (cfg.lovelaceConfig == null) then {}
-    else (lib.recursiveUpdate customLovelaceModulesResources cfg.lovelaceConfig);
-  lovelaceConfigFile = format.generate "ui-lovelace.yaml" lovelaceConfig;
+  lovelaceConfigFile = format.generate "ui-lovelace.yaml" cfg.lovelaceConfig;
 
   # Components advertised by the home-assistant package
   availableComponents = cfg.package.availableComponents;