29 lines
782 B
Nix
29 lines
782 B
Nix
{ config, lib, pkgs, ... }:
|
|
let
|
|
inherit (lib) mkIf mkEnableOption mkOption types;
|
|
cfg = config.services.zwave-js-ui;
|
|
in {
|
|
options.services.zwave-js-ui = {
|
|
enable = mkEnableOption "zwave-js-ui";
|
|
store = mkOption {
|
|
type = types.path;
|
|
default = "/var/lib/zwave-js-ui";
|
|
description = ''
|
|
Where zwave-js-ui information will be stored
|
|
'';
|
|
};
|
|
};
|
|
config = mkIf cfg.enable {
|
|
assertions = [{
|
|
assertion = !config.services.zwave-js.enable;
|
|
message = "zwave-js-ui conflicts with zwave-js";
|
|
}];
|
|
systemd.services.zwave-js-ui = {
|
|
environment = {
|
|
STORE_DIR = cfg.store;
|
|
ZWAVEJS_EXTERNAL_CONFIG = "${cfg.store}/.config-db";
|
|
};
|
|
script = "${pkgs.zwave-js-ui}/bin/zwave-js-ui";
|
|
};
|
|
};
|
|
}
|