From 0470d7f52fbb5740ca129c60a338cd5f36f95b3c Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Tue, 27 Aug 2024 20:43:30 +0200 Subject: [PATCH] nixos/services.journalbeat: remove `with lib;` --- .../modules/services/logging/journalbeat.nix | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/nixos/modules/services/logging/journalbeat.nix b/nixos/modules/services/logging/journalbeat.nix index e7d726ab1f61..5c35e84f88e0 100644 --- a/nixos/modules/services/logging/journalbeat.nix +++ b/nixos/modules/services/logging/journalbeat.nix @@ -1,7 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; - let cfg = config.services.journalbeat; @@ -18,24 +15,24 @@ in services.journalbeat = { - enable = mkEnableOption "journalbeat"; + enable = lib.mkEnableOption "journalbeat"; - package = mkPackageOption pkgs "journalbeat" { }; + package = lib.mkPackageOption pkgs "journalbeat" { }; - name = mkOption { - type = types.str; + name = lib.mkOption { + type = lib.types.str; default = "journalbeat"; description = "Name of the beat"; }; - tags = mkOption { - type = types.listOf types.str; + tags = lib.mkOption { + type = lib.types.listOf lib.types.str; default = []; description = "Tags to place on the shipped log messages"; }; - stateDir = mkOption { - type = types.str; + stateDir = lib.mkOption { + type = lib.types.str; default = "journalbeat"; description = '' Directory below `/var/lib/` to store journalbeat's @@ -44,8 +41,8 @@ in ''; }; - extraConfig = mkOption { - type = types.lines; + extraConfig = lib.mkOption { + type = lib.types.lines; default = ""; description = "Any other configuration options you want to add"; }; @@ -53,11 +50,11 @@ in }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { assertions = [ { - assertion = !hasPrefix "/" cfg.stateDir; + assertion = !lib.hasPrefix "/" cfg.stateDir; message = "The option services.journalbeat.stateDir shouldn't be an absolute directory." + " It should be a directory relative to /var/lib/.";