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
[WIP] Home Assistant #33675
[WIP] Home Assistant #33675
Conversation
Tests are currently disabled due to many errors. There are also pending commits on the 'dev' branch which fixes some tests. Also home-assistant installs more dependencies dynamically on every start via pip. This still needs to be fixed.
In order to prevent home-assistant from later pulling in dependencies, we could maybe replace the function install_package() by something like def install_package(package: str, upgrade: bool=True,
target: Optional[str]=None,
constraints: Optional[str]=None) -> bool:
return check_package_exists(package) I haven't tested this though. Also, I think there should be an option to specify additional components, which also requires the possibility to specify additional dependencies. |
buildPythonPackage rec { | ||
pname = "astral"; | ||
version = "1.4"; | ||
name = "${pname}-${version}"; |
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.
no name
{ stdenv, fetchPypi, buildPythonApplication }: | ||
|
||
buildPythonApplication rec { | ||
name = "${pname}-${version}"; |
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.
no name
@@ -0,0 +1,25 @@ | |||
{ stdenv, fetchPypi, buildPythonApplication }: | |||
|
|||
buildPythonApplication rec { |
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.
python-modules
and python-packages.nix
should contain only libraries ( buildPythonPackage
) and not applications (buildPythonApplication
).
{ stdenv, fetchFromGitHub, fetchurl, python3Packages, git, nmap }: | ||
|
||
python3Packages.buildPythonApplication rec { | ||
name = "${pname}-${version}"; |
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.
no name
sha256 = "164a87dh4zxw1a5nmlgwjc1nls0d4jjhdy5pzz43pgnwhhflbph3"; | ||
}; | ||
|
||
patchPhase = '' |
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.
postPatch
buildPythonPackage inherits from toPythonModule which automatically generates the name for the package with "name ? "${attrs.pname}-${attrs.version}" in the file mk-python-derivation.nix
The following implements
We may need to find a way to include additional dependencies. |
Earlier home-assistant PR #19508 |
@FRidh Thanks for the link to the old PR. I will have a look at it. Re. "--skip-pip": @flokli told me about a feature were you can give the application some sort of "virtual environment" so home-assistant would be able to install it's dependencies with pip. Maybe this is better than listing all the requirements per hand? (I start to think that HA was not the best choice for a first package when you want to learn packaging under NixOS cough) |
I've gone ahead and tried running
For the last one, I use PyPI and avoid generating any JS, CSS and HTML foo from source. user-agents depends on ua-parser, whose test I was not able to make run. They require to fetch a submodule but then still some errors occur, e.g.
Plus, I added some already packaged python packages to home-assistant's You can find the changes here: master...dotlambda:home-assistant-old What do you think, @FRidh? Should I make PRs for the 4 new python modules? |
@dotlambda how many more packages are going to be added? I mean, |
No, of course we shouldn't package all dependencies. |
I also think calling home-assistant using If the list of packages grows too much, we might do some plugins to packages translation in there, but as a start, this might be enough. Good to already see some of those packages landing in nixpkgs :-) It would maybe make sense to put |
Why did you add |
I have created a new version of the derivation for home-assistant, which you can find here: master...dotlambda:home-assistant. I hope you don't mind that I kept you as a maintainer, @f-breidenstein. What do you think, @FRidh? |
Would it be possible to use a tool to automatically generate nix expressions from home-assistants I guess home-assistant wouldn't be very useful if most of the components are missing dependencies. |
Yes that is possible, @bachp. See https://github.com/garbas/nixpkgs-python. But then, it cannot be included in nixpkgs from my understanding. |
@dotlambda, iirc I packaged everything which was mentioned in the requirements part of the @ALL: Sorry for the low amount of input to this discussion from my side, but regarding my limitied knownledge about nix and nixOS, I'm probably not very helpful by packaging such a beast like HA. |
Any thoughts on this, @FRidh? |
@dotlambda I think having the following would be good:
|
I have started
These should correspond to the default config: https://github.com/home-assistant/home-assistant/blob/master/homeassistant/config.py#L64 |
Closing in favor of #34188. Thanks for the work! |
Motivation for this change
This adds Home Assistant to NixOS.
Left to do:
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)