mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
zigbee2mqtt_2: init at 2.1.1
https://github.com/Koenkk/zigbee2mqtt/releases/tag/2.0.0 https://github.com/Koenkk/zigbee2mqtt/releases/tag/2.1.0 https://github.com/Koenkk/zigbee2mqtt/releases/tag/2.1.1
This commit is contained in:
parent
aab8e49e97
commit
99eabc0ab3
6 changed files with 125 additions and 32 deletions
|
@ -1,34 +1,44 @@
|
|||
import ./make-test-python.nix (
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
name = "zigbee2mqtt";
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
systemd.services.dummy-serial = {
|
||||
wantedBy = [
|
||||
"multi-user.target"
|
||||
];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.socat}/bin/socat pty,link=/dev/ttyACM0,mode=666 pty,link=/dev/ttyACM1";
|
||||
};
|
||||
};
|
||||
{
|
||||
lib,
|
||||
package,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
services.zigbee2mqtt = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
systemd.services.zigbee2mqtt.serviceConfig.DevicePolicy = lib.mkForce "auto";
|
||||
let
|
||||
error =
|
||||
if lib.versionOlder package.version "2" then
|
||||
"Inappropriate ioctl for device, cannot set"
|
||||
else
|
||||
"No valid USB adapter found";
|
||||
in
|
||||
{
|
||||
name = "zigbee2mqtt-${lib.versions.major package.version}.x";
|
||||
nodes.machine = {
|
||||
systemd.services.dummy-serial = {
|
||||
wantedBy = [
|
||||
"multi-user.target"
|
||||
];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.socat}/bin/socat pty,link=/dev/ttyACM0,mode=666 pty,link=/dev/ttyACM1";
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
machine.wait_until_fails("systemctl status zigbee2mqtt.service")
|
||||
machine.succeed(
|
||||
"journalctl -eu zigbee2mqtt | grep 'Error: Inappropriate ioctl for device, cannot set'"
|
||||
)
|
||||
services.zigbee2mqtt = {
|
||||
enable = true;
|
||||
inherit package;
|
||||
};
|
||||
|
||||
machine.log(machine.succeed("systemd-analyze security zigbee2mqtt.service"))
|
||||
'';
|
||||
}
|
||||
)
|
||||
systemd.services.zigbee2mqtt.serviceConfig.DevicePolicy = lib.mkForce "auto";
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
machine.wait_until_fails("systemctl status zigbee2mqtt.service")
|
||||
machine.succeed(
|
||||
"journalctl -eu zigbee2mqtt | grep '${error}'"
|
||||
)
|
||||
|
||||
machine.log(machine.succeed("systemd-analyze security zigbee2mqtt.service"))
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue