anchor.diff:  { config, lib, pkgs, ... }:
  +
   with lib;
  +
   let
     format = pkgs.formats.json { };
     cfg = config.services.influxdb2;
  
positive.code:       assertion = !(builtins.hasAttr "bolt-path" cfg.settings) && !(builtins.hasAttr "engine-path" cfg.settings);
        message = "services.influxdb2.config: bolt-path and engine-path should not be set as they are managed by systemd";
      }];
      systemd.services.influxdb2 = {
        description = "InfluxDB is an open-source, distributed, time series database";
        documentation = [ "https://docs.influxdata.com/influxdb/" ];
        wantedBy = [ "multi-user.target" ];
        after = [ "network.target" ];
        environment = {
          INFLUXD_CONFIG_PATH = "${configFile}";
        };
        serviceConfig = {
          ExecStart = "${cfg.package}/bin/influxd --bolt-path \${STATE_DIRECTORY}/influxd.bolt --engine-path \${STATE_DIRECTORY}/engine";
          StateDirectory = "influxdb2";
          DynamicUser = true;
          CapabilityBoundingSet = "";
          SystemCallFilter = "@system-service";
          LimitNOFILE = 65536;
  
negative.code:         Restart = "on-failure";
        };
      };
  
      users.extraUsers.influxdb2 = {
        isSystemUser = true;
        group = "influxdb2";
      };
  
      users.extraGroups.influxdb2 = {};
    };
  
    meta.maintainers = with lib.maintainers; [ nickcao ];
  