This is a collection of some infrastructure observability tools from New Relic packaged as Nix Flakes and accompanied by NixOS and nix-darwin modules.
Add Nix-Relic to your flake.nix
:
{
inputs.Nix-Relic.url = "https://flakehub.com/f/DavSanchez/Nix-Relic/*.tar.gz";
outputs = { self, Nix-Relic }: {
# Use in your outputs
};
}
# Make it available in your shell
nix shell github:DavSanchez/Nix-Relic#infrastructure-agent
# or build the package and find the outputs in ./result
nix build github:DavSanchez/Nix-Relic#infrastructure-agent
# Make it available in your shell
nix shell github:DavSanchez/Nix-Relic#ocb
# or build the package and find the outputs in ./result
nix build github:DavSanchez/Nix-Relic#ocb
# Make it available in your shell
nix shell github:DavSanchez/Nix-Relic#nr-otel-collector
# or build the package and find the outputs in ./result
nix build github:DavSanchez/Nix-Relic#nr-otel-collector
It might be possible that the modules defined here reference packages that are not yet present in nixpkgs
. If you encounter this problem, add this flake's default overlay to your nixpkgs.overlays
config. Assuming you have named this flake input as nix-relic
:
{
nixpkgs = {
overlays = [
inputs.nix-relic.overlays.additions
];
};
}
systemd
service{
services.newrelic-infra = {
enable = true;
configFile = ./newrelic-infra.yml;
};
}
A module for setting up an OpenTelemetry collector is already provided by NixOS, we only need to change it so it uses our New Relic Distribution package:
{
services.opentelemetry-collector = {
enable = true;
package = pkgs.nr-otel-collector; # Here!
configFile = ./nr-otel-collector.yaml;
};
}
launchd
daemon{
services.newrelic-infra = {
enable = true;
configFile = ./newrelic-infra.yml;
logFile = ./path/to/file.log;
errLogFile = ./path/to/errfile.log;
};
}
launchd
daemon{
services.nr-otel-collector = {
enable = true;
configFile = ./nr-otel-collector.yml;
logFile = ./path/to/file.log;
errLogFile = ./path/to/errfile.log;
};
}