9 cfg = config.services.govee2mqtt;
12 meta.maintainers = with lib.maintainers; [ SuperSandro2000 ];
14 options.services.govee2mqtt = {
15 enable = lib.mkEnableOption "Govee2MQTT";
17 package = lib.mkPackageOption pkgs "govee2mqtt" { };
21 default = "govee2mqtt";
22 description = "User under which Govee2MQTT should run.";
25 group = lib.mkOption {
27 default = "govee2mqtt";
28 description = "Group under which Govee2MQTT should run.";
31 environmentFile = lib.mkOption {
32 type = lib.types.path;
33 example = "/var/lib/govee2mqtt/govee2mqtt.env";
35 Environment file as defined in {manpage}`systemd.exec(5)`.
37 See upstream documentation <https://github.com/wez/govee2mqtt/blob/main/docs/CONFIG.md>.
42 config = lib.mkIf cfg.enable {
44 groups.${cfg.group} = { };
46 description = "Govee2MQTT service user";
52 systemd.services.govee2mqtt = {
53 description = "Govee2MQTT Service";
54 wantedBy = [ "multi-user.target" ];
55 after = [ "networking.target" ];
57 CacheDirectory = "govee2mqtt";
59 "GOVEE_CACHE_DIR=/var/cache/govee2mqtt"
61 EnvironmentFile = cfg.environmentFile;
63 "${lib.getExe cfg.package} serve --govee-iot-key=/var/lib/govee2mqtt/iot.key --govee-iot-cert=/var/lib/govee2mqtt/iot.cert"
64 + " --amazon-root-ca=${pkgs.cacert.unbundled}/etc/ssl/certs/Amazon_Root_CA_1:66c9fcf99bf8c0a39e2f0788a43e696365bca.crt";
66 Restart = "on-failure";
67 StateDirectory = "govee2mqtt";
71 AmbientCapabilities = "";
72 CapabilityBoundingSet = "";
73 LockPersonality = true;
74 NoNewPrivileges = true;
75 PrivateDevices = true;
81 ProtectControlGroups = true;
83 ProtectHostname = true;
84 ProtectKernelLogs = true;
85 ProtectKernelModules = true;
86 ProtectKernelTunables = true;
87 ProtectProc = "invisible";
88 ProtectSystem = "strict";
90 RestrictNamespaces = true;
91 RestrictRealtime = true;
92 RestrictSUIDSGID = true;
93 SystemCallArchitectures = "native";