nixos/services.vector: remove with lib;

This commit is contained in:
Felix Buehler
2024-08-30 00:30:58 +02:00
parent 640892113a
commit 28072b63dd
+8 -10
View File
@@ -1,24 +1,22 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.vector;
in
{
options.services.vector = {
enable = mkEnableOption "Vector, a high-performance observability data pipeline";
enable = lib.mkEnableOption "Vector, a high-performance observability data pipeline";
package = mkPackageOption pkgs "vector" { };
package = lib.mkPackageOption pkgs "vector" { };
journaldAccess = mkOption {
type = types.bool;
journaldAccess = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enable Vector to access journald.
'';
};
settings = mkOption {
settings = lib.mkOption {
type = (pkgs.formats.json { }).type;
default = { };
description = ''
@@ -27,7 +25,7 @@ in
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
# for cli usage
environment.systemPackages = [ pkgs.vector ];
@@ -49,14 +47,14 @@ in
'';
in
{
ExecStart = "${getExe cfg.package} --config ${validateConfig conf}";
ExecStart = "${lib.getExe cfg.package} --config ${validateConfig conf}";
DynamicUser = true;
Restart = "always";
StateDirectory = "vector";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
# This group is required for accessing journald.
SupplementaryGroups = mkIf cfg.journaldAccess "systemd-journal";
SupplementaryGroups = lib.mkIf cfg.journaldAccess "systemd-journal";
};
unitConfig = {
StartLimitIntervalSec = 10;