about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorLeona Maroni <dev@leona.is>2024-04-21 22:45:26 +0200
committerLeona Maroni <dev@leona.is>2024-04-28 13:53:10 +0200
commit5f27e501a1bc170d08d6093544eeac29b4e0214a (patch)
treee3cc29710b9a38f992836ef20ae3cfc8fdf79749 /nixos/modules/services
parentcc1c4a2832714f26c7e226bb3a8b73f4903383a8 (diff)
nixos/vmagent: remove global `with lib;`
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/monitoring/vmagent.nix42
1 files changed, 21 insertions, 21 deletions
diff --git a/nixos/modules/services/monitoring/vmagent.nix b/nixos/modules/services/monitoring/vmagent.nix
index cdcf1571154e9..0ce23c5ec7314 100644
--- a/nixos/modules/services/monitoring/vmagent.nix
+++ b/nixos/modules/services/monitoring/vmagent.nix
@@ -1,63 +1,63 @@
 { config, pkgs, lib, ... }:
-with lib;
+
 let
   cfg = config.services.vmagent;
   settingsFormat = pkgs.formats.json { };
 in {
   options.services.vmagent = {
-    enable = mkEnableOption "vmagent";
+    enable = lib.mkEnableOption "vmagent";
 
-    user = mkOption {
+    user = lib.mkOption {
       default = "vmagent";
-      type = types.str;
+      type = lib.types.str;
       description = ''
         User account under which vmagent runs.
       '';
     };
 
-    group = mkOption {
-      type = types.str;
+    group = lib.mkOption {
+      type = lib.types.str;
       default = "vmagent";
       description = ''
         Group under which vmagent runs.
       '';
     };
 
-    package = mkPackageOption pkgs "vmagent" { };
+    package = lib.mkPackageOption pkgs "vmagent" { };
 
-    dataDir = mkOption {
-      type = types.str;
+    dataDir = lib.mkOption {
+      type = lib.types.str;
       default = "/var/lib/vmagent";
       description = ''
         The directory where vmagent stores its data files.
       '';
     };
 
-    remoteWriteUrl = mkOption {
+    remoteWriteUrl = lib.mkOption {
       default = "http://localhost:8428/api/v1/write";
-      type = types.str;
+      type = lib.types.str;
       description = ''
         The storage endpoint such as VictoriaMetrics
       '';
     };
 
-    prometheusConfig = mkOption {
+    prometheusConfig = lib.mkOption {
       type = lib.types.submodule { freeformType = settingsFormat.type; };
       description = ''
         Config for prometheus style metrics
       '';
     };
 
-    openFirewall = mkOption {
-      type = types.bool;
+    openFirewall = lib.mkOption {
+      type = lib.types.bool;
       default = false;
       description = ''
         Whether to open the firewall for the default ports.
       '';
     };
 
-    extraArgs = mkOption {
-      type = types.listOf types.str;
+    extraArgs = lib.mkOption {
+      type = lib.types.listOf lib.types.str;
       default = [];
       description = ''
         Extra args to pass to `vmagent`. See the docs:
@@ -67,10 +67,10 @@ in {
     };
   };
 
-  config = mkIf cfg.enable {
-    users.groups = mkIf (cfg.group == "vmagent") { vmagent = { }; };
+  config = lib.mkIf cfg.enable {
+    users.groups = lib.mkIf (cfg.group == "vmagent") { vmagent = { }; };
 
-    users.users = mkIf (cfg.user == "vmagent") {
+    users.users = lib.mkIf (cfg.user == "vmagent") {
       vmagent = {
         group = cfg.group;
         description = "vmagent daemon user";
@@ -79,7 +79,7 @@ in {
       };
     };
 
-    networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ 8429 ];
+    networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ 8429 ];
 
     systemd.services.vmagent = let
       prometheusConfig = settingsFormat.generate "prometheusConfig.yaml" cfg.prometheusConfig;
@@ -93,7 +93,7 @@ in {
         Type = "simple";
         Restart = "on-failure";
         WorkingDirectory = cfg.dataDir;
-        ExecStart = "${cfg.package}/bin/vmagent -remoteWrite.url=${cfg.remoteWriteUrl} -promscrape.config=${prometheusConfig} ${escapeShellArgs cfg.extraArgs}";
+        ExecStart = "${cfg.package}/bin/vmagent -remoteWrite.url=${cfg.remoteWriteUrl} -promscrape.config=${prometheusConfig} ${lib.escapeShellArgs cfg.extraArgs}";
       };
     };