mdirkse
January 10, 2025, 11:30am
1
Hi all,
I use Nixos to run my Raspberry Pi4-based Home Assistant installation. Nixos supports a bunch of custom components out of the box , but I want to install one that isn’t pre-packaged: GitHub - zachowj/hass-node-red: Companion Component for node-red-contrib-home-assistant-websocket to help integrate Node-RED with Home Assistant Core
I figured this would be as easy as copying the definition of one of the prepacked ones (like this one ) into my config, replacing the values with the appropriate ones for the component I need (see the result here ), and running nixos-rebuild
.
Unfortunately it doesn’t seem to be that simple, as including the file yields an “infinite recursion” error. I’m a relative Nixos n00b and have no idea where to start debugging the problem. Anyone have any tips?
The error:
error: infinite recursion encountered
at /nix/store/fz4h8yz3qr83p6cfhisgj02knjqg6nxs-source/lib/modules.nix:515:28:
514| addErrorContext (context name)
515| (args.${name} or config._module.args.${name})
| ^
516| ) (functionArgs f);
Regards,
Maarten
mvb
January 10, 2025, 12:10pm
2
This is just a wild guess, but your reference doesn’t inherit owner but doubly defines it. Have you tried doing the same?
hexa
January 10, 2025, 12:34pm
3
I fixed the package to build in nixpkgs. That doesn’t explain why there is an infinite recursion for you though.
{
lib,
buildHomeAssistantComponent,
fetchFromGitHub,
...
}:
buildHomeAssistantComponent rec {
owner = "zachowj";
domain = "nodered";
version = "4.1.2";
src = fetchFromGitHub {
inherit owner;
repo = "hass-node-red";
tag = "v${version}";
hash = "sha256-qRQ4NMKmZUQ9wSYR8i8TPbQc3y69Otp7FSdGuwph14c=";
};
meta = with lib; {
description = "Companion Component for node-red-contrib-home-assistant-websocket";
homepage = "https://github.com/zachowj/hass-node-red/";
changelog = "https://github.com/zachowj/hass-node-red/releases/tag/${version}";
license = licenses.mit;
};
}
custom_components/
custom_components/__init__.py
custom_components/nodered/
custom_components/nodered/__init__.py
custom_components/nodered/binary_sensor.py
custom_components/nodered/button.py
custom_components/nodered/config_flow.py
custom_components/nodered/const.py
custom_components/nodered/discovery.py
custom_components/nodered/manifest.json
custom_components/nodered/number.py
custom_components/nodered/select.py
custom_components/nodered/sensor.py
custom_components/nodered/sentence.py
custom_components/nodered/services.yaml
custom_components/nodered/switch.py
custom_components/nodered/text.py
custom_components/nodered/time.py
custom_components/nodered/translations/
custom_components/nodered/translations/de.json
custom_components/nodered/translations/dk.json
custom_components/nodered/translations/en.json
custom_components/nodered/translations/fr.json
custom_components/nodered/translations/nb.json
custom_components/nodered/translations/pl.json
custom_components/nodered/translations/pt-BR.json
custom_components/nodered/translations/pt-pt.json
custom_components/nodered/translations/sk.json
custom_components/nodered/translations/sv.json
custom_components/nodered/translations/zh-CN.json
custom_components/nodered/utils.py
custom_components/nodered/version.py
custom_components/nodered/websocket.py
nix-support/
nix-support/propagated-build-inputs
hexa
January 10, 2025, 12:36pm
4
{ inputs, lib, config, pkgs, ... }: {
imports = [ ./hass-node-red-module.nix ./zwave.nix ];
services.home-assistant = {
enable = true;
extraComponents = [
"backup"
"bluetooth"
"bluetooth_adapters"
"esphome"
"homekit_controller"
"isal"
You cannot import a package like a module. Try the following instead:
services.home-assistant.customComponents = [
(config.services.home-assistant.package.python.pkgs.callPackage ./hass-node-red-module.nix {})
];