nixos-vps/modules/netdata.nix
ashisgreat22 6cd9c91c38 fix: add nginx dependency and documentation to Netdata module
- Add missing nginx dependency declaration
- Add trailing newline at end of file
- Document why contentSecurityPolicy is set to null
2026-03-22 01:45:51 +00:00

58 lines
No EOL
1.2 KiB
Nix

# Netdata Module
# Provides: Real-time system monitoring dashboard
#
# Usage:
# myModules.netdata = {
# enable = true;
# domain = "netdata.example.com";
# };
#
# Access is restricted to Tailscale network only via nginx internalOnly.
{
config,
lib,
...
}:
let
cfg = config.myModules.netdata;
in
{
options.myModules.netdata = {
enable = lib.mkEnableOption "Netdata real-time monitoring";
domain = lib.mkOption {
type = lib.types.str;
example = "netdata.example.com";
description = "Public domain name for Netdata dashboard";
};
port = lib.mkOption {
type = lib.types.port;
default = 19999;
description = "Internal port for Netdata to listen on";
};
};
config = lib.mkIf cfg.enable {
myModules.nginx.enable = true; # Ensure nginx is enabled
services.netdata = {
enable = true;
config = {
global = {
"bind to" = "0.0.0.0:${toString cfg.port}";
};
};
};
# Nginx reverse proxy - restricted to Tailscale network
myModules.nginx.domains.${cfg.domain} = {
port = cfg.port;
internalOnly = true;
contentSecurityPolicy = null; # Netdata dashboard has its own CSP requirements, cannot be overridden
};
};
}