2024-08-20 21:49:04 -04:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib) mkIf mkEnableOption mkOption types;
|
|
|
|
cfg = config.services.zwave-js-ui;
|
2024-08-28 21:24:00 -04:00
|
|
|
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
|
|
|
|
'';
|
2024-08-20 21:49:04 -04:00
|
|
|
};
|
2024-08-28 21:24:00 -04:00
|
|
|
};
|
|
|
|
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";
|
2024-08-20 21:49:04 -04:00
|
|
|
};
|
2024-08-28 21:24:00 -04:00
|
|
|
script = "${pkgs.zwave-js-ui}/bin/zwave-js-ui";
|
2024-08-20 21:49:04 -04:00
|
|
|
};
|
2024-08-28 21:24:00 -04:00
|
|
|
};
|
|
|
|
}
|