|
1 | | -{ self, lib, config, pkgs, ... }: |
2 | | - |
3 | | -let |
4 | | - weathermap = pkgs.stdenv.mkDerivation { |
5 | | - pname = "librenms-weathermap"; |
6 | | - version = "2023-12-17-unstable"; |
7 | | - |
8 | | - src = pkgs.fetchFromGitHub { |
9 | | - owner = "librenms-plugins"; |
10 | | - repo = "Weathermap"; |
11 | | - # master as of 04.03.2025 |
12 | | - rev = "ea57b454eb042408a6628fc3d8dff8176563547f"; |
13 | | - hash = "sha256-q+/j16FNVNseJMm1p7pj6YWX5RpGVp367+s/NChcxHo="; |
14 | | - }; |
15 | | - |
16 | | - postPatch = '' |
17 | | - substituteInPlace weathermap.php \ |
18 | | - --replace-fail '/usr/bin/rrdtool' '${lib.getExe' pkgs.rrdtool "rrdtool"}' |
19 | | - ''; |
20 | | - |
21 | | - installPhase = '' |
22 | | - mkdir $out |
23 | | - mv * $out |
24 | | - rm -rf $out/configs |
25 | | - ln -s /var/lib/librenms-weathermap $out/configs |
26 | | - ''; |
27 | | - }; |
28 | | -in |
| 1 | +{ self, config, ... }: |
29 | 2 |
|
30 | 3 | { |
31 | 4 | sops.secrets."nms_db_pass" = { |
|
35 | 8 |
|
36 | 9 | services.librenms = { |
37 | 10 | enable = true; |
38 | | - package = pkgs.librenms.override { |
39 | | - plugins = [{ |
40 | | - dir = weathermap; |
41 | | - name = "Weathermap"; |
42 | | - }]; |
43 | | - }; |
44 | 11 | database = { |
45 | 12 | host = "svc-mari01.dd-ix.net"; |
46 | 13 | port = 3306; |
|
59 | 26 |
|
60 | 27 | onlySSL = true; |
61 | 28 | useACMEHost = "nms.${config.dd-ix.domain}"; |
62 | | - |
63 | | - locations."/plugins/Weathermap/" = { |
64 | | - # taken from |
65 | | - # https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/modules/services/monitoring/librenms.nix#L482C7-L483C62 |
66 | | - index = "index.php"; |
67 | | - tryFiles = "$uri $uri/ /index.php?$query_string"; |
68 | | - extraConfig = '' |
69 | | - allow 2a01:7700:80b0:e000::/64; |
70 | | - deny all; |
71 | | - ''; |
72 | | - }; |
73 | | - }; |
74 | | - }; |
75 | | - |
76 | | - systemd = { |
77 | | - services.librenms-weathermap-poller = { |
78 | | - description = "LibreNMS Weathermap Poller"; |
79 | | - |
80 | | - path = [ |
81 | | - config.services.librenms.package.passthru.phpPackage |
82 | | - ]; |
83 | | - |
84 | | - serviceConfig = { |
85 | | - Type = "oneshot"; |
86 | | - inherit (config.systemd.services.librenms-scheduler.serviceConfig) WorkingDirectory User Group; |
87 | | - ExecStart = "${config.systemd.services.librenms-scheduler.serviceConfig.WorkingDirectory}/html/plugins/Weathermap/map-poller.php"; |
88 | | - }; |
89 | | - }; |
90 | | - |
91 | | - timers.librenms-weathermap-poller = { |
92 | | - description = "LibreNMS Weathermap Poller"; |
93 | | - wantedBy = [ "timers.target" ]; |
94 | | - timerConfig = { |
95 | | - # every 5min |
96 | | - OnCalendar = "*:0/5"; |
97 | | - AccuracySec = "1second"; |
98 | | - }; |
99 | 29 | }; |
100 | 30 | }; |
101 | 31 | } |
0 commit comments