Skip to content

Commit 35f9b4c

Browse files
authored
zigbee2mqtt_2: init at 2.1.1 (#371053)
2 parents d075548 + 99eabc0 commit 35f9b4c

7 files changed

Lines changed: 176 additions & 82 deletions

File tree

nixos/doc/manual/release-notes/rl-2505.section.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@
261261

262262
- `nodePackages."@commitlint/config-conventional"` has been removed, as it is a library, and projects should depend on it instead.
263263

264+
- zigbee2mqtt is now available in version 2.x as `zigbee2mqtt_2`. In NixOS 25.11 we'll remove `zigbee2mqtt_1` and default to `zigbee2mqtt_2`. See the [breaking changes](https://github.com/Koenkk/zigbee2mqtt/discussions/24198) announcement for 2.0.0.
265+
264266
- `nodePackages.vls` has been deprecated, as the upstream consumer of it, vetur, has been deprecated by upstream. Upstream suggests migrating to Volar for Vue LSP tooling instead.
265267

266268
- `nodePackages.create-react-native-app` has been removed, as it is deprecated. Upstream suggests using a framework for React Native apps instead.

nixos/modules/services/home-automation/zigbee2mqtt.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ in
125125
SystemCallFilter = [
126126
"@system-service @pkey"
127127
"~@privileged @resources"
128+
"@chown"
128129
];
129130
UMask = "0077";
130131
};

nixos/tests/all-tests.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,14 @@ in {
12611261
zenohd = handleTest ./zenohd.nix {};
12621262
zeronet-conservancy = handleTest ./zeronet-conservancy.nix {};
12631263
zfs = handleTest ./zfs.nix {};
1264-
zigbee2mqtt = handleTest ./zigbee2mqtt.nix {};
1264+
zigbee2mqtt_1 = runTest {
1265+
imports = [ ./zigbee2mqtt.nix ];
1266+
_module.args.package = pkgs.zigbee2mqtt_1;
1267+
};
1268+
zigbee2mqtt_2 = runTest {
1269+
imports = [ ./zigbee2mqtt.nix ];
1270+
_module.args.package = pkgs.zigbee2mqtt_2;
1271+
};
12651272
zipline = handleTest ./zipline.nix {};
12661273
zoneminder = handleTest ./zoneminder.nix {};
12671274
zookeeper = handleTest ./zookeeper.nix {};

nixos/tests/zigbee2mqtt.nix

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
1-
import ./make-test-python.nix (
2-
{ pkgs, lib, ... }:
3-
{
4-
name = "zigbee2mqtt";
5-
nodes.machine =
6-
{ pkgs, ... }:
7-
{
8-
systemd.services.dummy-serial = {
9-
wantedBy = [
10-
"multi-user.target"
11-
];
12-
serviceConfig = {
13-
ExecStart = "${pkgs.socat}/bin/socat pty,link=/dev/ttyACM0,mode=666 pty,link=/dev/ttyACM1";
14-
};
15-
};
1+
{
2+
lib,
3+
package,
4+
pkgs,
5+
...
6+
}:
167

17-
services.zigbee2mqtt = {
18-
enable = true;
19-
};
20-
21-
systemd.services.zigbee2mqtt.serviceConfig.DevicePolicy = lib.mkForce "auto";
8+
let
9+
error =
10+
if lib.versionOlder package.version "2" then
11+
"Inappropriate ioctl for device, cannot set"
12+
else
13+
"No valid USB adapter found";
14+
in
15+
{
16+
name = "zigbee2mqtt-${lib.versions.major package.version}.x";
17+
nodes.machine = {
18+
systemd.services.dummy-serial = {
19+
wantedBy = [
20+
"multi-user.target"
21+
];
22+
serviceConfig = {
23+
ExecStart = "${pkgs.socat}/bin/socat pty,link=/dev/ttyACM0,mode=666 pty,link=/dev/ttyACM1";
2224
};
25+
};
26+
27+
services.zigbee2mqtt = {
28+
enable = true;
29+
inherit package;
30+
};
31+
32+
systemd.services.zigbee2mqtt.serviceConfig.DevicePolicy = lib.mkForce "auto";
33+
};
2334

24-
testScript = ''
25-
machine.wait_for_unit("multi-user.target")
26-
machine.wait_until_fails("systemctl status zigbee2mqtt.service")
27-
machine.succeed(
28-
"journalctl -eu zigbee2mqtt | grep 'Error: Inappropriate ioctl for device, cannot set'"
29-
)
35+
testScript = ''
36+
machine.wait_for_unit("multi-user.target")
37+
machine.wait_until_fails("systemctl status zigbee2mqtt.service")
38+
machine.succeed(
39+
"journalctl -eu zigbee2mqtt | grep '${error}'"
40+
)
3041
31-
machine.log(machine.succeed("systemd-analyze security zigbee2mqtt.service"))
32-
'';
33-
}
34-
)
42+
machine.log(machine.succeed("systemd-analyze security zigbee2mqtt.service"))
43+
'';
44+
}
Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1 @@
1-
{
2-
lib,
3-
stdenv,
4-
buildNpmPackage,
5-
fetchFromGitHub,
6-
systemdMinimal,
7-
nixosTests,
8-
nix-update-script,
9-
withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal,
10-
}:
11-
12-
buildNpmPackage rec {
13-
pname = "zigbee2mqtt";
14-
version = "1.42.0";
15-
16-
src = fetchFromGitHub {
17-
owner = "Koenkk";
18-
repo = "zigbee2mqtt";
19-
rev = version;
20-
hash = "sha256-/7mZrf3FyIliCzsy6yzVRJYMy4bViphYi81UY43iO98=";
21-
};
22-
23-
npmDepsHash = "sha256-heqTYLC+TQPQ2dc5MrVdvJeNqrygC4tUgkLcfKvlYvE=";
24-
25-
buildInputs = lib.optionals withSystemd [
26-
systemdMinimal
27-
];
28-
29-
npmFlags = lib.optionals (!withSystemd) [ "--omit=optional" ];
30-
31-
passthru.tests.zigbee2mqtt = nixosTests.zigbee2mqtt;
32-
passthru.updateScript = nix-update-script { };
33-
34-
meta = with lib; {
35-
changelog = "https://github.com/Koenkk/zigbee2mqtt/releases/tag/${version}";
36-
description = "Zigbee to MQTT bridge using zigbee-shepherd";
37-
homepage = "https://github.com/Koenkk/zigbee2mqtt";
38-
license = licenses.gpl3;
39-
longDescription = ''
40-
Allows you to use your Zigbee devices without the vendor's bridge or gateway.
41-
42-
It bridges events and allows you to control your Zigbee devices via MQTT.
43-
In this way you can integrate your Zigbee devices with whatever smart home infrastructure you are using.
44-
'';
45-
maintainers = with maintainers; [
46-
sweber
47-
hexa
48-
];
49-
mainProgram = "zigbee2mqtt";
50-
};
51-
}
1+
{ zigbee2mqtt_1 }: zigbee2mqtt_1
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
lib,
3+
stdenv,
4+
buildNpmPackage,
5+
fetchFromGitHub,
6+
systemdMinimal,
7+
nixosTests,
8+
nix-update-script,
9+
withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal,
10+
}:
11+
12+
buildNpmPackage rec {
13+
pname = "zigbee2mqtt";
14+
version = "1.42.0";
15+
16+
src = fetchFromGitHub {
17+
owner = "Koenkk";
18+
repo = "zigbee2mqtt";
19+
rev = version;
20+
hash = "sha256-/7mZrf3FyIliCzsy6yzVRJYMy4bViphYi81UY43iO98=";
21+
};
22+
23+
npmDepsHash = "sha256-heqTYLC+TQPQ2dc5MrVdvJeNqrygC4tUgkLcfKvlYvE=";
24+
25+
buildInputs = lib.optionals withSystemd [
26+
systemdMinimal
27+
];
28+
29+
npmFlags = lib.optionals (!withSystemd) [ "--omit=optional" ];
30+
31+
passthru.tests.zigbee2mqtt = nixosTests.zigbee2mqtt_1;
32+
passthru.updateScript = nix-update-script { };
33+
34+
meta = with lib; {
35+
changelog = "https://github.com/Koenkk/zigbee2mqtt/releases/tag/${version}";
36+
description = "Zigbee to MQTT bridge using zigbee-shepherd";
37+
homepage = "https://github.com/Koenkk/zigbee2mqtt";
38+
license = licenses.gpl3;
39+
longDescription = ''
40+
Allows you to use your Zigbee devices without the vendor's bridge or gateway.
41+
42+
It bridges events and allows you to control your Zigbee devices via MQTT.
43+
In this way you can integrate your Zigbee devices with whatever smart home infrastructure you are using.
44+
'';
45+
maintainers = with maintainers; [
46+
sweber
47+
hexa
48+
];
49+
mainProgram = "zigbee2mqtt";
50+
};
51+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
nodejs,
6+
npmHooks,
7+
pnpm_9,
8+
systemdMinimal,
9+
nixosTests,
10+
nix-update-script,
11+
withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal,
12+
}:
13+
14+
let
15+
pnpm = pnpm_9;
16+
in
17+
stdenv.mkDerivation (finalAttrs: {
18+
pname = "zigbee2mqtt";
19+
version = "2.1.1";
20+
21+
src = fetchFromGitHub {
22+
owner = "Koenkk";
23+
repo = "zigbee2mqtt";
24+
tag = finalAttrs.version;
25+
hash = "sha256-YVsQ4Zo0nlIb9m4wiK7xcqB7eE/h2ZvTTqEYLDagoHM=";
26+
};
27+
28+
pnpmDeps = pnpm.fetchDeps {
29+
inherit (finalAttrs) pname version src;
30+
hash = "sha256-Wr7FngKfedUrtOLpaTxvAdJZfCXo1/+oLMIJMOCgafk=";
31+
};
32+
33+
nativeBuildInputs = [
34+
nodejs
35+
npmHooks.npmInstallHook
36+
pnpm.configHook
37+
];
38+
39+
buildInputs = lib.optionals withSystemd [
40+
systemdMinimal
41+
];
42+
43+
buildPhase = ''
44+
runHook preBuild
45+
46+
pnpm run build
47+
48+
runHook postBuild
49+
'';
50+
51+
dontNpmPrune = true;
52+
53+
passthru.tests.zigbee2mqtt = nixosTests.zigbee2mqtt_2;
54+
passthru.updateScript = nix-update-script { };
55+
56+
meta = with lib; {
57+
changelog = "https://github.com/Koenkk/zigbee2mqtt/releases/tag/${finalAttrs.version}";
58+
description = "Zigbee to MQTT bridge using zigbee-shepherd";
59+
homepage = "https://github.com/Koenkk/zigbee2mqtt";
60+
license = licenses.gpl3;
61+
longDescription = ''
62+
Allows you to use your Zigbee devices without the vendor's bridge or gateway.
63+
64+
It bridges events and allows you to control your Zigbee devices via MQTT.
65+
In this way you can integrate your Zigbee devices with whatever smart home infrastructure you are using.
66+
'';
67+
maintainers = with maintainers; [
68+
sweber
69+
hexa
70+
];
71+
mainProgram = "zigbee2mqtt";
72+
};
73+
})

0 commit comments

Comments
 (0)