diff options
author | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2023-12-20 04:19:05 +0100 |
---|---|---|
committer | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2023-12-20 05:00:05 +0100 |
commit | d4c622ec5f952dbbe4d0608d49e5725ef1d2f58b (patch) | |
tree | de264b5b6de9a3209b36227e3d0dcd518a34e3ee /nixos | |
parent | 64121103ec8253dce1c285ffd2b1e35f0351fe30 (diff) |
nixos/home-assistant: fix removing of uninstalled custom components
Before components was not an array and the first loop did never loop through all entries but through the entire output of find without splitting by new line. Tested by copying the preStart script out of the nix store, doing the change and observing that now the custom-components directory is indeed being cleaned up after removing a custom component.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/home-automation/home-assistant.nix | 4 |
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 2a6b07c6f1a6e..bc470576b759b 100644 --- a/nixos/modules/services/home-automation/home-assistant.nix +++ b/nixos/modules/services/home-automation/home-assistant.nix @@ -468,8 +468,8 @@ in { mkdir -p "${cfg.configDir}/custom_components" # remove components symlinked in from below the /nix/store - components="$(find "${cfg.configDir}/custom_components" -maxdepth 1 -type l)" - for component in "$components"; do + readarray -d "" components < <(find "${cfg.configDir}/custom_components" -maxdepth 1 -type l -print0) + for component in "''${components[@]}"; do if [[ "$(readlink "$component")" =~ ^${escapeShellArg builtins.storeDir} ]]; then rm "$component" fi |