my Nix configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

graphs.nix 966B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # use together with ./collectd.nix
  2. { config, pkgs, lib, ...}:
  3. let
  4. secrets = import <secrets>;
  5. grafana_port = 3000;
  6. domain = "graphs.yori.cc";
  7. in
  8. {
  9. networking.firewall.allowedUDPPorts = [25826];
  10. services.influxdb = {
  11. enable = true;
  12. extraConfig = {
  13. collectd = [{
  14. enabled = true;
  15. typesdb = "${pkgs.collectd}/share/collectd/types.db";
  16. database = "collectd_db";
  17. "security-level" = "sign";
  18. "auth-file" = pkgs.writeText "collectd_auth"
  19. (builtins.concatStringsSep "\n" (lib.mapAttrsToList (n: p: "${n}: ${p}") secrets.influx_pass) + "\n");
  20. port = 25826;
  21. }];
  22. };
  23. };
  24. services.grafana = {
  25. enable = true;
  26. inherit domain;
  27. rootUrl = "https://${domain}/";
  28. port = grafana_port;
  29. };
  30. services.nginx.virtualHosts.${domain} = {
  31. enableACME = true;
  32. forceSSL = true;
  33. locations."/" = {
  34. proxyPass = "http://127.0.0.1:${toString grafana_port}";
  35. };
  36. };
  37. }