-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/home-assistant: fix bug causing config file not to be written (including http.server_port
)
#82480
Conversation
…viour If the `config` option is not set, the `port` option has no effect. This is caused by the condition `cfg.config != null` not passing, resulting in the default `configuration.yaml` file not being overwritten. If `time.timeZone` isn't set, it also appears to cause home-assistant to error out. Another issue is that the `defaultConfig` doesn't currently set `frontend` which means in the minimal setup with just `port` set, we still won't be able to reach the frontend.
Hello, I'm a bot and I thank you in the name of the community for your contributions. Nixpkgs is a busy repository, and unfortunately sometimes PRs get left behind for too long. Nevertheless, we'd like to help committers reach the PRs that are still important. This PR has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human. If this is still important to you and you'd like to remove the stale label, we ask that you leave a comment. Your comment can be as simple as "still important to me". But there's a bit more you can do: If you received an approval by an unprivileged maintainer and you are just waiting for a merge, you can @ mention someone with merge permissions and ask them to help. You might be able to find someone relevant by using Git blame on the relevant files, or via GitHub's web interface. You can see if someone's a member of the nixpkgs-committers team, by hovering with the mouse over their username on the web interface, or by searching them directly on the list. If your PR wasn't reviewed at all, it might help to find someone who's perhaps a user of the package or module you are changing, or alternatively, ask once more for a review by the maintainer of the package/module this is about. If you don't know any, you can use Git blame on the relevant files, or GitHub's web interface to find someone who touched the relevant files in the past. If your PR has had reviews and nevertheless got stale, make sure you've responded to all of the reviewer's requests / questions. Usually when PR authors show responsibility and dedication, reviewers (privileged or not) show dedication as well. If you've pushed a change, it's possible the reviewer wasn't notified about your push via email, so you can always officially request them for a review, or just @ mention them and say you've addressed their comments. Lastly, you can always ask for help at our Discourse Forum, or more specifically, at this thread or at #nixos' IRC channel. |
@colemickens or @dotlambda does this change make sense to either of you? |
I'm not sure I'm familiar enough, or having enough time, to review this well. cc: @Mic92 even though I think they've seen it. |
ping @colemickens @dotlambda @Mic92 @peterhoeg I'm sure @matt-snider would appreciate a review very much so. Is anyone able to sacrifice some time and help out with this? ❤️ |
@@ -225,7 +228,7 @@ in { | |||
systemd.services.home-assistant = { | |||
description = "Home Assistant"; | |||
after = [ "network.target" ]; | |||
preStart = optionalString (cfg.config != null) (if cfg.configWritable then '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the actual bug fix is this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but I believe frontend
missing was also causing issues. It's been quite a while though and it's not that fresh anymore. I'll have to spend some time going through and running it in various situations.
hassMinimal = mkHass {}; | ||
|
||
hassTimeZone = mkHass { | ||
machineAttrs = { time.timeZone = "UTC"; }; | ||
}; | ||
|
||
hassNoDefault = mkHass { | ||
hassAttrs = { applyDefaultConfig = false; }; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we are going to need all those tests. They don't test much but still needs to be maintained and they are expensive to evaluate. It would be fine if they only would generate the configuration but they spawn actual VMs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Mic92 thanks for the feedback. This was my feeling as well, but I wasn't sure how to do unit tests in Nix. Perhaps I just missed some examples or documentation. Is there anything you could point me to that might help?
Thank you @Mic92! |
I marked this as stale due to inactivity. → More info |
@matt-snider what do you need to push this through to the finish line? |
@aanderse Thanks for following up! I think the main suggestion from @Mic92 was to remove the tests. Otherwise, from his comment "So the actual bug fix is this line?", I interpret that a more minimal change would be preferable. That's understandable, since it probably would have allowed this to be more easily approved. Perhaps we should just close this PR, since it's over a year old, and I haven't run it with newer versions of home assistant. It doesn't seem to affect many people, judging by activity on this PR and the original issue. |
Sorry things didn't go super smooth. |
@aanderse Not at all. I should have been more proactive with this one. Thank you for all the work you and many others do on Nix. It really is an incredible project! I'd like to help out more but you know... time management :-/ |
Motivation for this change
This fixes #82076 by ensuring that the configuration.yaml file is always (over)written. I think this approach simplifies things a bit, and to me aligns more with what I would assume "default config" means. I'm not sure it's the right way though, since it changes the behaviour of
applyDefaultConfig
.It would be great to get some feedback on a few points in particular:
defaultConfig
to a subset of the contents of the default configuration.yaml file plus the port and timezone? For now I just have frontend in there. This might be less of a breaking change but it would mean keeping up to date when home-assistant changes that file. For reference, this is what that file looks like:NOTE: some of the home-assistant tests seem to be failing currently, but this appears to be caused by #82441
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)