Skip to content

Instantly share code, notes, and snippets.

@NickSeagull
Forked from oneingan/override.nix
Created July 6, 2022 11:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickSeagull/8e186ec05283086645a670538c5d8e71 to your computer and use it in GitHub Desktop.
Save NickSeagull/8e186ec05283086645a670538c5d8e71 to your computer and use it in GitHub Desktop.
zigbee2mqtt in nixos
{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 ];
};
}
{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