nixos/services.journalbeat: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-27 20:43:30 +02:00
parent d0885b12f2
commit 0470d7f52f

View file

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.services.journalbeat; cfg = config.services.journalbeat;
@ -18,24 +15,24 @@ in
services.journalbeat = { services.journalbeat = {
enable = mkEnableOption "journalbeat"; enable = lib.mkEnableOption "journalbeat";
package = mkPackageOption pkgs "journalbeat" { }; package = lib.mkPackageOption pkgs "journalbeat" { };
name = mkOption { name = lib.mkOption {
type = types.str; type = lib.types.str;
default = "journalbeat"; default = "journalbeat";
description = "Name of the beat"; description = "Name of the beat";
}; };
tags = mkOption { tags = lib.mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
default = []; default = [];
description = "Tags to place on the shipped log messages"; description = "Tags to place on the shipped log messages";
}; };
stateDir = mkOption { stateDir = lib.mkOption {
type = types.str; type = lib.types.str;
default = "journalbeat"; default = "journalbeat";
description = '' description = ''
Directory below `/var/lib/` to store journalbeat's Directory below `/var/lib/` to store journalbeat's
@ -44,8 +41,8 @@ in
''; '';
}; };
extraConfig = mkOption { extraConfig = lib.mkOption {
type = types.lines; type = lib.types.lines;
default = ""; default = "";
description = "Any other configuration options you want to add"; description = "Any other configuration options you want to add";
}; };
@ -53,11 +50,11 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
{ {
assertion = !hasPrefix "/" cfg.stateDir; assertion = !lib.hasPrefix "/" cfg.stateDir;
message = message =
"The option services.journalbeat.stateDir shouldn't be an absolute directory." + "The option services.journalbeat.stateDir shouldn't be an absolute directory." +
" It should be a directory relative to /var/lib/."; " It should be a directory relative to /var/lib/.";