about summary refs log tree commit diff
path: root/nixos/modules/services/home-automation/home-assistant.nix
diff options
context:
space:
mode:
authorKacper Koniuszy <120419423+kkoniuszy@users.noreply.github.com>2024-06-23 18:41:00 +0200
committerKacper Koniuszy <120419423+kkoniuszy@users.noreply.github.com>2024-06-23 22:03:37 +0200
commit7b81a213cfaf02cdc6c8196dbd8b00978a778d4f (patch)
tree5b440a258f764cbb2cbd5105fd1b7cf411dec07d /nixos/modules/services/home-automation/home-assistant.nix
parentca39b726c75579507d3bec92226ec03bfa981067 (diff)
nixos/home-assistant: fix symlinking multi-manifest custom components
frenck/spook includes a second manifest for an integration. The current
copyCustomComponents script assumed that only one component directory
will be found, which in this case resulted in a malformed symlink
destination:

lrwxrwxrwx 1 hass hass 224 Jun 23 17:23 spook -> '/nix/store/r41ics22zs578avzqf7x86plcgn2q71h-python3.12-frenck-spook-v3.0.1/custom_components/spook/integrations/spook_inverse'$'\n''/nix/store/r41ics22zs578avzqf7x86plcgn2q71h-python3.12-frenck-spook-v3.0.1/custom_components/spook'
Diffstat (limited to 'nixos/modules/services/home-automation/home-assistant.nix')
-rw-r--r--nixos/modules/services/home-automation/home-assistant.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix
index d94adfb4aa1c7..c58a31539ed81 100644
--- a/nixos/modules/services/home-automation/home-assistant.nix
+++ b/nixos/modules/services/home-automation/home-assistant.nix
@@ -518,8 +518,9 @@ in {
           # recreate symlinks for desired components
           declare -a components=(${escapeShellArgs cfg.customComponents})
           for component in "''${components[@]}"; do
-            path="$(dirname $(find "$component" -name "manifest.json"))"
-            ln -fns "$path" "${cfg.configDir}/custom_components/"
+            readarray -t manifests < <(find "$component" -name manifest.json)
+            readarray -t paths < <(dirname "''${manifests[@]}")
+            ln -fns "''${paths[@]}" "${cfg.configDir}/custom_components/"
           done
         '';
       in