-
-
Save NickSeagull/8e186ec05283086645a670538c5d8e71 to your computer and use it in GitHub Desktop.
zigbee2mqtt in nixos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{pkgs ? import <nixpkgs> { | |
inherit system; | |
}, system ? builtins.currentSystem}: | |
let | |
nodePackages = import ./default.nix { | |
inherit pkgs system; | |
}; | |
in | |
nodePackages // { | |
zigbee2mqtt = nodePackages.package.override { | |
buildInputs = [ pkgs.nodePackages.node-gyp ]; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{config, pkgs, lib, ...}: | |
let | |
nodePackages = import ./override.nix { | |
inherit pkgs; | |
}; | |
in | |
{ | |
systemd.services.zigbee2mqtt = { | |
wantedBy = ["multi-user.target" ]; | |
after = [ "network.target" ]; | |
description = "Run zigbee2mqtt as daemon"; | |
serviceConfig = { | |
WorkingDirectory = ''${nodePackages.zigbee2mqtt}/lib/node_modules/zigbee2mqtt''; | |
ExecStart = ''${pkgs.nodejs-12_x}/bin/node index.js''; | |
StandardOutput = "inherit"; | |
StandardError = "inherit"; | |
Restart = "always"; | |
User = "root"; | |
StateDirectory = "zigbee 2mqtt"; | |
#DeviceAllow = "/dev/ttyACM0 rw"; | |
}; | |
environment = { ZIGBEE2MQTT_DATA = "/var/lib/zigbee2mqtt"; }; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment