about summary refs log tree commit diff
path: root/modules/promtail.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/promtail.nix')
-rw-r--r--modules/promtail.nix22
1 files changed, 11 insertions, 11 deletions
diff --git a/modules/promtail.nix b/modules/promtail.nix
index 65d88d4..cf4eb3b 100644
--- a/modules/promtail.nix
+++ b/modules/promtail.nix
@@ -4,34 +4,33 @@
   this,
   ...
 }:
-with lib;
 let
   cfg = config.nixfiles.modules.promtail;
 in
 {
   options.nixfiles.modules.promtail = {
-    enable = mkEnableOption "Promtail";
+    enable = lib.mkEnableOption "Promtail";
 
-    port = mkOption {
+    port = lib.mkOption {
       description = "Port.";
-      type = with types; port;
+      type = lib.types.port;
       default = 30181;
     };
 
-    loki.url = mkOption {
+    loki.url = lib.mkOption {
       description = "Address of a listening Loki service.";
-      type = with types; str;
+      type = lib.types.str;
       default = "https://${config.nixfiles.modules.loki.domain}";
     };
 
-    filters = mkOption {
+    filters = lib.mkOption {
       description = ''Filters to use with "scrape_config.pipeline_stages".'';
-      type = with types; listOf attrs;
+      type = with lib.types; listOf attrs;
       default = [ ];
     };
   };
 
-  config = mkIf cfg.enable {
+  config = lib.mkIf cfg.enable {
     services.promtail = {
       enable = true;
 
@@ -70,11 +69,12 @@ in
                 (
                   n:
                   let
-                    label = toLower n;
+                    label = lib.toLower n;
                   in
                   {
                     source_labels = [ "__journal_${label}" ];
-                    target_label = if hasPrefix "_" label then substring 1 (stringLength label - 1) label else label;
+                    target_label =
+                      if lib.hasPrefix "_" label then lib.substring 1 (lib.stringLength label - 1) label else label;
                   }
                 )
                 [

Consider giving Nix/NixOS a try! <3