{ lib, config, inputs, ... }: let gatusPort = 8080; in { imports = [inputs.nixos-hardware.nixosModules.raspberry-pi-4]; config = { pim = { tailscale.advertiseExitNode = true; prometheus.enable = true; }; facter.reportPath = ./facter.json; system.stateVersion = "23.05"; systemd.network.networks."30-main-nic" = { matchConfig.Name = lib.mkForce "end*"; networkConfig.IPv6AcceptRA = true; }; deployment = { targetHost = "warwick"; targetUser = "root"; tags = ["server"]; buildOnTarget = true; }; boot.loader.systemd-boot.enable = lib.mkForce false; users.users.root.openssh.authorizedKeys.keys = config.pim.ssh.keys.pim ++ config.pim.ssh.keys.niels; fileSystems."/" = { device = "/dev/disk/by-label/NIXOS_SD"; fsType = "ext4"; options = ["noatime"]; }; networking.firewall.allowedTCPPorts = [gatusPort]; systemd.services.gatus.serviceConfig.EnvironmentFile = config.sops.secrets."gatus/env".path; services.gatus = { enable = true; settings = { alerting = let default-alert = { enabled = true; failure-threshold = 2; success-threshold = 1; send-on-resolved = true; }; in { email = { from = "gatus@kun.is"; host = "mail.smtp2go.com"; port = 2525; to = "pim@kunis.nl"; client.insecure = true; username = "$SMTP_USERNAME"; password = "$SMTP_PASSWORD"; click = "http://warwick:${toString gatusPort}"; inherit default-alert; }; ntfy = { url = "https://ntfy.kun.is"; token = "$NTFY_ACCESS_TOKEN"; inherit default-alert; }; }; web.port = gatusPort; endpoints = let status = code: "[STATUS] == ${toString code}"; bodyContains = text: "[BODY] == pat(*${text}*)"; maxResponseTime = ms: "[RESPONSE_TIME] < ${toString ms}"; serviceEndpoints = [ { name = "Blog"; url = "https://pim.kun.is"; conditions = [ (status 200) (maxResponseTime 300) ]; } { name = "Cyberchef"; url = "https://cyberchef.kun.is"; conditions = [ (status 200) (maxResponseTime 300) (bodyContains "CyberChef - The Cyber Swiss Army Knife") ]; } { name = "HedgeDoc"; url = "https://md.kun.is/status"; conditions = [ (status 200) (maxResponseTime 300) "[BODY].notesCount > 0" ]; } { name = "Forgejo"; url = "https://git.kun.is"; conditions = [ (status 200) (maxResponseTime 300) (bodyContains "Forgejo: Beyond coding. We forge.") ]; } { name = "Authentik"; url = "https://authentik.kun.is/-/health/live/"; conditions = [ (status 200) (maxResponseTime 300) ]; } { name = "Ntfy"; url = "https://ntfy.kun.is"; conditions = [ (status 200) (maxResponseTime 300) ]; } { name = "Jellyfin"; url = "https://media.kun.is/health"; conditions = [ (status 200) (maxResponseTime 300) ]; } { name = "Attic"; url = "https://attic.kun.is"; conditions = [ (status 200) (bodyContains "attic push") (maxResponseTime 300) ]; } { name = "Esrom"; url = "https://esrom.kun.is/seinlamp"; conditions = [ (status 200) (bodyContains "Welcome to") (maxResponseTime 300) ]; } { name = "Atuin"; url = "https://atuin.kun.is"; conditions = [ (status 200) (maxResponseTime 300) "[BODY].total_history > 0" ]; } { name = "KitchenOwl"; url = "https://boodschappen.kun.is"; conditions = [ (status 200) (maxResponseTime 300) (bodyContains "