diff options
author | Ryan Mulligan <ryan@ryantm.com> | 2021-08-09 10:34:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 10:34:53 -0700 |
commit | 33cdc784e8fb972f49bd1caee2fe9c0d071be510 (patch) | |
tree | 5c7accd6fffd2cf8c162914eec108db25d2a87c3 /nixos/modules/services/databases | |
parent | 250ea10c0f0e09b92cba7a1b35f3c2422731ae86 (diff) | |
parent | 5c2478ba3cc2e66a2373c6ff9946346e2f746f8c (diff) | |
download | nixpkgs-33cdc784e8fb972f49bd1caee2fe9c0d071be510.tar nixpkgs-33cdc784e8fb972f49bd1caee2fe9c0d071be510.tar.gz nixpkgs-33cdc784e8fb972f49bd1caee2fe9c0d071be510.tar.bz2 nixpkgs-33cdc784e8fb972f49bd1caee2fe9c0d071be510.tar.lz nixpkgs-33cdc784e8fb972f49bd1caee2fe9c0d071be510.tar.xz nixpkgs-33cdc784e8fb972f49bd1caee2fe9c0d071be510.tar.zst nixpkgs-33cdc784e8fb972f49bd1caee2fe9c0d071be510.zip |
Merge pull request #131545 from NickCao/influxdb2
nixos/influxdb2: init
Diffstat (limited to 'nixos/modules/services/databases')
-rw-r--r-- | nixos/modules/services/databases/influxdb2.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/nixos/modules/services/databases/influxdb2.nix b/nixos/modules/services/databases/influxdb2.nix new file mode 100644 index 00000000000..df7bac4261b --- /dev/null +++ b/nixos/modules/services/databases/influxdb2.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, ... }: +with lib; +let + format = pkgs.formats.json { }; + cfg = config.services.influxdb2; + configFile = format.generate "config.json" cfg.settings; +in +{ + options = { + services.influxdb2 = { + enable = mkEnableOption "the influxdb2 server"; + package = mkOption { + default = pkgs.influxdb2; + defaultText = "pkgs.influxdb2"; + description = "influxdb2 derivation to use."; + type = types.package; + }; + settings = mkOption { + default = { }; + description = "configuration options for influxdb2, see https://docs.influxdata.com/influxdb/v2.0/reference/config-options for details."; + type = format.type; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [{ + 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; + KillMode = "control-group"; + Restart = "on-failure"; + }; + }; + }; + + meta.maintainers = with lib.maintainers; [ nickcao ]; +} |