Merge pull request #118516 from happysalada/fix_vector
This commit is contained in:
commit
95a5678118
1 changed files with 23 additions and 20 deletions
|
@ -3,7 +3,8 @@
|
|||
with lib;
|
||||
let cfg = config.services.vector;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.vector = {
|
||||
enable = mkEnableOption "Vector";
|
||||
|
||||
|
@ -37,25 +38,27 @@ in {
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
requires = [ "network-online.target" ];
|
||||
serviceConfig = let
|
||||
format = pkgs.formats.toml { };
|
||||
conf = format.generate "vector.toml" cfg.settings;
|
||||
validateConfig = file:
|
||||
pkgs.runCommand "validate-vector-conf" { } ''
|
||||
${pkgs.vector}/bin/vector validate --no-topology --no-environment "${file}"
|
||||
ln -s "${file}" "$out"
|
||||
'';
|
||||
in {
|
||||
ExecStart = "${pkgs.vector}/bin/vector --config ${validateConfig conf}";
|
||||
User = "vector";
|
||||
Group = "vector";
|
||||
Restart = "no";
|
||||
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";
|
||||
};
|
||||
serviceConfig =
|
||||
let
|
||||
format = pkgs.formats.toml { };
|
||||
conf = format.generate "vector.toml" cfg.settings;
|
||||
validateConfig = file:
|
||||
pkgs.runCommand "validate-vector-conf" { } ''
|
||||
${pkgs.vector}/bin/vector validate --no-environment "${file}"
|
||||
ln -s "${file}" "$out"
|
||||
'';
|
||||
in
|
||||
{
|
||||
ExecStart = "${pkgs.vector}/bin/vector --config ${validateConfig conf}";
|
||||
User = "vector";
|
||||
Group = "vector";
|
||||
Restart = "no";
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue