about summary refs log tree commit diff
path: root/nixos/modules/services/home-automation
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2023-12-02 22:27:23 +0100
committerSandro Jäckel <sandro.jaeckel@gmail.com>2023-12-02 23:04:48 +0100
commit57bfbc781c39b51aa440f0d1aebead78eab9bdf4 (patch)
tree54956e064fadaebce8fec48df057ed73d85d9f96 /nixos/modules/services/home-automation
parentab3ea20adfe05a2328b4991612912ef7db67af83 (diff)
nixos/home-assistant: fix error when switching between writable and none writable lovelace config
error message before was:
cp: not writing through dangling symlink '/var/lib/hass/ui-lovelace.yaml'
Diffstat (limited to 'nixos/modules/services/home-automation')
-rw-r--r--nixos/modules/services/home-automation/home-assistant.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix
index 54fd3e17292f6..6aa0ae9eba47a 100644
--- a/nixos/modules/services/home-automation/home-assistant.nix
+++ b/nixos/modules/services/home-automation/home-assistant.nix
@@ -455,10 +455,10 @@ in {
           ln -s /etc/home-assistant/configuration.yaml "${cfg.configDir}/configuration.yaml"
         '';
         copyLovelaceConfig = if cfg.lovelaceConfigWritable then ''
+          rm -f "${cfg.configDir}/ui-lovelace.yaml"
           cp --no-preserve=mode ${lovelaceConfigFile} "${cfg.configDir}/ui-lovelace.yaml"
         '' else ''
-          rm -f "${cfg.configDir}/ui-lovelace.yaml"
-          ln -s /etc/home-assistant/ui-lovelace.yaml "${cfg.configDir}/ui-lovelace.yaml"
+          ln -fs /etc/home-assistant/ui-lovelace.yaml "${cfg.configDir}/ui-lovelace.yaml"
         '';
         copyCustomLovelaceModules = if cfg.customLovelaceModules != [] then ''
           mkdir -p "${cfg.configDir}/www"