mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-07-02 07:27:20 +02:00
Merge branch 'main' of github.com:JulienMalka/nix-config
This commit is contained in:
commit
0941348da1
12 changed files with 117 additions and 50 deletions
|
@ -15,7 +15,6 @@ in
|
|||
enableACME = true;
|
||||
forceSSL = true;
|
||||
root = inputs.homepage;
|
||||
default = true;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."www.julienmalka.me" = {
|
||||
|
|
|
@ -13,6 +13,7 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
security.acme.email = "${cfg.email}";
|
||||
security.acme.acceptTerms = true;
|
||||
users.groups.nginx = { name = "nginx"; };
|
||||
|
|
10
modules/status/checks.csv
Normal file
10
modules/status/checks.csv
Normal file
|
@ -0,0 +1,10 @@
|
|||
http, 200, Lisa, https://google.com
|
||||
http, 200, Homepage, https://julienmalka.me
|
||||
http, 200, CI, https://ci.julienmalka.me
|
||||
http, 200, Jellyfin, https://tv.julienmalka.me
|
||||
http, 200, Transmission, https://downloads.julienmalka.me
|
||||
http, 200, Sonarr, https://series.julienmalka.me
|
||||
http, 200, Radarr, https://films.julienmalka.me
|
||||
http, 200, Jackett, https://jackett.julienmalka.me/UI/Dashboard
|
||||
port, 0, Newton, newton.julienmalka.me 45
|
||||
http, 200, Cloud, cloud.julienmalka.me
|
|
52
modules/status/default.nix
Normal file
52
modules/status/default.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.luj.status;
|
||||
in
|
||||
{
|
||||
|
||||
options.luj.status = {
|
||||
enable = mkEnableOption "activate status page";
|
||||
nginx.enable = mkEnableOption "activate nginx";
|
||||
nginx.subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [{
|
||||
systemd = {
|
||||
timers.tinystatus = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "tinystatus.service" ];
|
||||
timerConfig.OnCalendar = "*-*-* *:05,10,15,20,25,30,35,40,45,50,55:00";
|
||||
timerConfig.Unit = "tinystatus.service";
|
||||
};
|
||||
services.tinystatus = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
path = [ pkgs.gawk pkgs.gnused pkgs.curl pkgs.netcat pkgs.unixtools.ping ];
|
||||
script = ''
|
||||
mkdir -p /var/www/status
|
||||
${pkgs.tinystatus}/bin/tinystatus ${./checks.csv} > /var/www/status/index.html
|
||||
${pkgs.gnused}/bin/sed -i 's/tinystatus/Services status/g' /var/www/status/index.html
|
||||
${pkgs.gnused}/bin/sed -i 's/80%/60%/g' /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