Install Vector on NixOS
NixOS is a Linux distribution built on top of the Nix package manager. This page covers installing and managing Vector on NixOS.
Nixpkgs has a community maintained module for Vector, the options for which may be viewed on the NixOS Search.
This can be used to deploy and configure Vector on a NixOS system.
For example, place into a system’s configuration.nix
:
services.vector = {
enable = true;
journaldAccess = true;
settings = builtins.fromTOML ''
[sources.journald]
type = "journald"
current_boot_only = true
[sources.vector_metrics]
type = "internal_metrics"
[sinks.loki]
type = "loki"
inputs = [ "journald" ]
endpoint = "https://loki.mycompany.com"
[sinks.loki.labels]
source = "journald"
[sinks.prometheus_exporter]
type = "prometheus_exporter"
inputs = [ "vector_metrics" ]
address = "[::]:9598"
'';
};
The module will also verify that the Vector configuration is valid before enabling any changes.
See also the Nix package page.