From 7b81a213cfaf02cdc6c8196dbd8b00978a778d4f Mon Sep 17 00:00:00 2001 From: Kacper Koniuszy <120419423+kkoniuszy@users.noreply.github.com> Date: Sun, 23 Jun 2024 18:41:00 +0200 Subject: [PATCH] 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' --- nixos/modules/services/home-automation/home-assistant.nix | 5 +++-- 1 file 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 d94adfb4aa1c..c58a31539ed8 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