mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-06-09 02:19:06 +02:00
Added status page
This commit is contained in:
parent
48c36bbd4c
commit
a42a771ece
7 changed files with 88 additions and 0 deletions
48
modules/status/default.nix
Normal file
48
modules/status/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.luj.status;
|
||||
in
|
||||
{
|
||||
|
||||
options.luj.jackett = {
|
||||
enable = mkEnableOption "activate status page";
|
||||
nginx.enable = mkEnableOption "activate nginx";
|
||||
nginx.subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [{
|
||||
systemd = {
|
||||
timers.simple-timer = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "tinystatus.service" ];
|
||||
timerConfig.OnCalendar = "minutely";
|
||||
};
|
||||
services.tinystatus = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir -p /var/www/status
|
||||
${pkgs.tinystatus}/bin/tinystatus ${./checks.csv} > /var/www/status/index.html
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
root = "/var/www/status/";
|
||||
};
|
||||
|
||||
})]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue