Files
nix-config/modules/nixos/homeassistant/services/govee2mqtt/default.nix
2026-04-05 15:10:13 -05:00

47 lines
1.2 KiB
Nix

{
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;
};
};
};
}