1 { config, pkgs, lib, name, ... }:
5 enable = lib.mkOption {
9 Whether to enable status app.
14 config = lib.mkIf config.myServices.status.enable {
17 dest = "naemon-status/environment";
22 TOKENS=${builtins.concatStringsSep " " config.myEnv.monitoring.nrdp_tokens}
28 recommendedOptimisation = true;
29 recommendedGzipSettings = true;
30 recommendedProxySettings = true;
31 virtualHosts."status.immae.eu" = {
32 acmeRoot = config.security.acme.certs."${name}".webroot;
35 locations."/".proxyPass = "http://unix:/run/naemon-status/socket.sock:/";
38 security.acme.certs."${name}" = {
39 extraDomains."status.immae.eu" = null;
40 user = config.services.nginx.user;
41 group = config.services.nginx.group;
44 myServices.certificates.enable = true;
45 networking.firewall.allowedTCPPorts = [ 80 443 ];
46 systemd.services.naemon-status = {
47 description = "Naemon status";
48 after = [ "network.target" ];
49 wantedBy = [ "multi-user.target" ];
52 EnvironmentFile = config.secrets.fullPaths."naemon-status/environment";
54 WorkingDirectory = "${./status}";
56 python = pkgs.python3.withPackages (p: [ p.gunicorn p.flask p.flask_login ]);
58 "${python}/bin/gunicorn -w4 --bind unix:/run/naemon-status/socket.sock app:app";
60 RuntimeDirectory = "naemon-status";
61 StandardOutput = "journal";
62 StandardError = "inherit";