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, ... }:
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/.";