about summary refs log tree commit diff
path: root/nixos/tests/home-assistant.nix
AgeCommit message (Collapse)AuthorFilesLines
2023-12-09nixos/tests/home-assistant: check for lovelace resources in configMartin Weinelt1-1/+1
This was recently fixed, but the test was not updated.
2023-12-06buildHomeAssistantComponent: migrate from pname to owner/domainMartin Weinelt1-1/+1
Also make the attribute name to match the domain name. This is more in line with the home-assistant custom component ecosystem and allows additional validation between the derivation and the manifest. Also, at a later time, this will enable us to check for domain conflicts at eval time.
2023-11-13nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15Maximilian Bosch1-7/+5
Closes #216989 First of all, a bit of context: in PostgreSQL, newly created users don't have the CREATE privilege on the public schema of a database even with `ALL PRIVILEGES` granted via `ensurePermissions` which is how most of the DB users are currently set up "declaratively"[1]. This means e.g. a freshly deployed Nextcloud service will break early because Nextcloud itself cannot CREATE any tables in the public schema anymore. The other issue here is that `ensurePermissions` is a mere hack. It's effectively a mixture of SQL code (e.g. `DATABASE foo` is relying on how a value is substituted in a query. You'd have to parse a subset of SQL to actually know which object are permissions granted to for a user). After analyzing the existing modules I realized that in every case with a single exception[2] the UNIX system user is equal to the db user is equal to the db name and I don't see a compelling reason why people would change that in 99% of the cases. In fact, some modules would even break if you'd change that because the declarations of the system user & the db user are mixed up[3]. So I decided to go with something new which restricts the ways to use `ensure*` options rather than expanding those[4]. Effectively this means that * The DB user _must_ be equal to the DB name. * Permissions are granted via `ensureDBOwnerhip` for an attribute-set in `ensureUsers`. That way, the user is actually the owner and can perform `CREATE`. * For such a postgres user, a database must be declared in `ensureDatabases`. For anything else, a custom state management should be implemented. This can either be `initialScript`, doing it manual, outside of the module or by implementing proper state management for postgresql[5], but the current state of `ensure*` isn't even declarative, but a convergent tool which is what Nix actually claims to _not_ do. Regarding existing setups: there are effectively two options: * Leave everything as-is (assuming that system user == db user == db name): then the DB user will automatically become the DB owner and everything else stays the same. * Drop the `createDatabase = true;` declarations: nothing will change because a removal of `ensure*` statements is ignored, so it doesn't matter at all whether this option is kept after the first deploy (and later on you'd usually restore from backups anyways). The DB user isn't the owner of the DB then, but for an existing setup this is irrelevant because CREATE on the public schema isn't revoked from existing users (only not granted for new users). [1] not really declarative though because removals of these statements are simply ignored for instance: https://github.com/NixOS/nixpkgs/issues/206467 [2] `services.invidious`: I removed the `ensure*` part temporarily because it IMHO falls into the category "manage the state on your own" (see the commit message). See also https://github.com/NixOS/nixpkgs/pull/265857 [3] e.g. roundcube had `"DATABASE ${cfg.database.username}" = "ALL PRIVILEGES";` [4] As opposed to other changes that are considered a potential fix, but also add more things like collation for DBs or passwords that are _never_ touched again when changing those. [5] As suggested in e.g. https://github.com/NixOS/nixpkgs/issues/206467
2023-11-10nixos/tests/home-assistant: test custom things cleanupMartin Weinelt1-0/+15
Make sure we properly remove custom components and custom lovelace modules, when they're not configured anymore.
2023-11-10nixos/tests/home-assistant: test loading custom componentsMartin Weinelt1-0/+9
2023-11-10nixos/tests/home-assistant: test loading lovelace modulesMartin Weinelt1-0/+9
2023-11-04nixos/tests/home-assistant: replace ensureUsers with custom setup script for nowK9001-7/+7
(cherry picked from commit 30d70bf6058e2261048986b9db909ae291779d5c)
2023-06-07nixos/tests/home-assistant: Drop esphome, fix post-restart expectationMartin Weinelt1-2/+1
Mentioning esphome in the config is now causing an error. Check for the backup module post-restart, not esphome.
2023-05-20nixos/tests/home-assistant: Don't test matterMartin Weinelt1-1/+0
It is affected by the OpenSSL 1.1 EOL and removing it makes hydra build this test again.
2023-04-28nixosTests.home-assistant: Test more componentsMartin Weinelt1-1/+8
2023-02-20nixos/tests/home-assistant: Resolve deprecation warningMartin Weinelt1-1/+1
> trace: warning: Module argument `nodes.hass.config` is deprecated. Use `nodes.hass` instead.
2023-02-20nixos/tests/home-assistant: Check dependencies arrive in the PYTHONPATHMartin Weinelt1-0/+12
Both extraPackages and derived packages from extraComponents should be present in the units PYTHONPATH environment variable.
2023-02-20nixos/tests/home-assistant: Overhaul and refactorMartin Weinelt1-48/+45
Prepare the tests for a change in dependency handling, by not relying on bespoke files dropped into the package output. Instead we now check the journal log for whether a configured component was setup, once for the initial specialisation another time for the one introducing esphome configuration. Also improve abstractions for getting journal data relative to a cursor and generally make a few things more concise.
2022-12-17nixos: fix typosfigsoda1-1/+1
2022-07-14nixos/tests/home-assistant: improve reload/restart test casesMartin Weinelt1-6/+19
Wait until home-assistant is fully reloaded or restarted to spot possible errors during startup. Swap out bluetooth_tracker for esphome, since the bluetooth tracker causes errors, when it does not find a bluetooth device. Drop mosquitto from the environment. It wasn't used since the 2022.3.0 release when MQTT stopped being configurable from the YAML config.
2022-06-22nixos/tests/home-assistant: stop printing logMartin Weinelt1-5/+1
With multiple specialization changes this isn't very helpful anymore, but no biggie since we check the log for errors anyway and the log is not too verbose anyway.
2022-06-22nixos/home-assistant: reload the daemon when configuration changedAndreas Rammhold1-1/+31
Reload the service when configuration changes. This means that we don't have a potentially slow startup for every small configuration change.
2022-06-03nixos/tests/home-assistant: assert regex matchMartin Weinelt1-0/+1
Fixes type checking done against the test driver.
2022-03-05nixos/tests/home-assistant: drop mqtt testsMartin Weinelt1-43/+0
With Home Assistant 2022.3.0 the MQTT configuration cannot be done declaratively anymore, so this test scenario has been rendered moot.
2022-02-15nixos/tests/home-assistant: test package and components passingMartin Weinelt1-0/+21
There are now multiple combinations of how one can pass either extraPackages or extraComponents. We now test those passed directly to the package via an override, and those passed indirectly via the module, that ultimately results in a second override to the package.
2022-02-15nixos/tests/home-assistant: test module-based package loadingMartin Weinelt1-0/+19
Passing psycopg2 for PostgreSQL support in the recorder component is one of the more popular use cases to pass an extra package.
2022-02-15nixos/tests/home-assistant: test module-based component loadingMartin Weinelt1-1/+5
2022-02-15nixos/tests/home-assistant: add comments & reformatMartin Weinelt1-12/+44
2022-01-25nixos/tests/home-assistant: test ping via wake_on_lan componentMartin Weinelt1-0/+10
Let the home-assistant instance linger around for 30s so it can run regular jobs and trigger more code paths that could result in errors.
2021-12-01nixos/tests/home-assistant: test hardening with extraComponentsMartin Weinelt1-0/+7
2021-10-22nixos/mosquitto: rewrite the modulepennae1-6/+7
mosquitto needs a lot of attention concerning its config because it doesn't parse it very well, often ignoring trailing parts of lines, duplicated config keys, or just looking back way further in the file to associated config keys with previously defined items than might be expected. this replaces the mosquitto module completely. we now have a hierarchical config that flattens out to the mosquitto format (hopefully) without introducing spooky action at a distance.
2021-06-28nixos/tests/home-assistant: don't test packageRobert Schütz1-2/+0
The modules overrides extraComponents which leads to a costly rebuild of the home-assistant package with all tests. Make it less costly by not running the tests, as does the default for the package option. The package's tests are already run by ofborg on every pull request as well as by Hydra when building home-assistant.
2021-06-16nixos/home-assistant: update hardeningMartin Weinelt1-0/+2
This makes access to serial devices contingent on using certain components and restricts the default setup even further.
2021-05-03nixos/tests/home-assistant: update maintainership to home-assistant teamMartin Weinelt1-4/+2
2021-05-03nixos/tests/home-assistant: test capability passingMartin Weinelt1-0/+10
Configures the emulated_hue component and expects CAP_NET_BIND_SERVICE to be passed in order to be able to bind to 80/tcp. Also print the systemd security analysis, so we can spot changes more quickly.
2021-04-09nixos/tests/home-assistant: fix mosquitto configurationMartin Weinelt1-6/+4
Things broke after mosquitto was upgraded in f07c81b.
2021-03-06nixos/home-assistant: disable tests on the package by defaultMartin Weinelt1-0/+2
We are running over 6000 tests by now and they take around 5 minutes on faster machines and tests alot of components that endusers will not actually be using. It is sufficient if we run them on package upgrades and in the passthrough test.
2021-01-10treewide: simplify pkgs.stdenv.lib -> pkgs.libDominik Xaver Hörl1-1/+1
The library does not depend on stdenv, that `stdenv` exposes `lib` is an artifact of the ancient origins of nixpkgs.
2020-07-07nixos/tests/home-assistant: replace internal mqtt broker with mosquittoMartin Weinelt1-4/+17
The internal broker was deprecated since 0.92.0 and removed in 0.112.0.
2020-06-21nixos/home-assistant: fix testsJörg Thalheim1-73/+46
2020-05-21home-assistant: 0.109.6 → 0.110.0Martin Weinelt1-1/+1
2020-01-09nixosTests.home-assistant: port to pythonOleksii Filonenko1-32/+39
2019-03-24home-assistant: 0.89.2 -> 0.90.1 (#58017)Robert Schütz1-2/+4
https://www.home-assistant.io/blog/2019/03/20/release-90/
2019-02-21home-assistant-cli: 0.5.0 -> 0.6.0Robert Schütz1-2/+2
2019-02-06Merge pull request #54541 from dotlambda/home-assistant-0.86Peter Hoeg1-2/+16
home-assistant: 0.85.1 -> 0.86.4
2019-02-03nixos/home-assistant: add configWritable optionRobert Schütz1-2/+4
2019-01-29home-assistant-cli: 0.3.0 -> 0.4.2Robert Schütz1-1/+1
2019-01-29nixos/home-assistant: don't run json2yaml at every startRobert Schütz1-1/+2
2019-01-29nixos/home-assistant: add lovelaceConfig optionRobert Schütz1-0/+11
2018-12-19home-assistant-cli: init at 0.3.0Robert Schütz1-1/+7
2018-12-06home-assistant: 0.82.1 -> 0.83.3Robert Schütz1-0/+3
2018-10-29nixos/tests/home-assistant: no longer ignore "Timer got out of sync" errorRobert Schütz1-2/+1
That error message was removed in https://github.com/home-assistant/home-assistant/pull/17398.
2018-08-21home-assistant: 0.75.2 -> 0.76.1Robert Schütz1-3/+6
Also simplify the way overrides are defined for better readability and use the opportunity to introduce a packageOverrides option.
2018-07-20[bot] nixos/*: remove unused arguments in lambdasvolth1-1/+1
2018-05-18nixos/tests/home-assistant: ignore "Timer got out of sync" error (#40735)Robert Schütz1-1/+2