47 lines
1.2 KiB
Nix
Executable File
47 lines
1.2 KiB
Nix
Executable File
{
|
|
config,
|
|
lib,
|
|
namespace,
|
|
...
|
|
}:
|
|
with lib;
|
|
let
|
|
cfg = config.${namespace}.services.home-assistant;
|
|
in
|
|
{
|
|
config = mkIf cfg.enable {
|
|
sops = {
|
|
secrets = {
|
|
"jallen-nas/govee2mqtt/govee-email" = {
|
|
sopsFile = lib.snowfall.fs.get-file "secrets/nas-secrets.yaml";
|
|
};
|
|
"jallen-nas/govee2mqtt/govee-password" = {
|
|
sopsFile = lib.snowfall.fs.get-file "secrets/nas-secrets.yaml";
|
|
};
|
|
"jallen-nas/govee2mqtt/govee-api" = {
|
|
sopsFile = lib.snowfall.fs.get-file "secrets/nas-secrets.yaml";
|
|
};
|
|
};
|
|
templates = {
|
|
"govee2mqtt.env" = {
|
|
mode = "660";
|
|
restartUnits = [ "govee2mqtt.service" ];
|
|
content = ''
|
|
# GOVEE_EMAIL=${config.sops.placeholder."jallen-nas/govee2mqtt/govee-email"}
|
|
# GOVEE_PASSWORD=${config.sops.placeholder."jallen-nas/govee2mqtt/govee-password"}
|
|
GOVEE_API_KEY=${config.sops.placeholder."jallen-nas/govee2mqtt/govee-api"}
|
|
GOVEE_MQTT_HOST=localhost
|
|
GOVEE_MQTT_PORT=1883
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
services = {
|
|
govee2mqtt = {
|
|
enable = true;
|
|
environmentFile = config.sops.templates."govee2mqtt.env".path;
|
|
};
|
|
};
|
|
};
|
|
}
|