From 63af2c4f4e40775ae2d1c41db159b56d5dd21821 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Tue, 26 May 2026 14:31:55 +0200 Subject: [PATCH 1/2] stay up wifi daemon --- configuration.nix | 3 ++- system-modules/stay-up.nix | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 system-modules/stay-up.nix diff --git a/configuration.nix b/configuration.nix index b28a892..a985d53 100644 --- a/configuration.nix +++ b/configuration.nix @@ -46,11 +46,12 @@ ./system-modules/simple-postgres.nix ] ++ (if hyper.isServer then [ + ./system-modules/stay-up.nix + ./system-modules/nx2site.nix ./system-modules/hugo.nix ./system-modules/postgres.nix ./system-modules/nx2site/proxy.nix - # ./system-modules/nx2site/smtp.nix # ./system-modules/nx2site/imap.nix # ./system-modules/nx2site/vmail.nix diff --git a/system-modules/stay-up.nix b/system-modules/stay-up.nix new file mode 100644 index 0000000..ad1cf79 --- /dev/null +++ b/system-modules/stay-up.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }@all: with all; let + target = "1.1.1.1"; + timeoutMinutes = 5; + logFile = "/var/log/stay-up.log"; +in { + systemd.services.wifi-watchdog = { + description = "Wi-Fi Watchdog Service"; + after = [ "network.target" "NetworkManager.service" ]; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ iputils networkmanager coreutils ]; + script = /* bash */ '' + FAIL_COUNT=0 + touch "${logFile}" + while true; do + if ping -c 1 -W 5 "${target}" > /dev/null 2>&1; then + FAIL_COUNT=0 + else + FAIL_COUNT=$((FAIL_COUNT + 1)) + if [ "$FAIL_COUNT" -ge "${toString timeoutMinutes}" ]; then + echo "$(date -Iseconds): Network unreachable for ${toString timeoutMinutes} minutes. Restarting Wi-Fi." >> "${logFile}" + nmcli radio wifi off + sleep 5 + nmcli radio wifi on + FAIL_COUNT=0 + fi + fi + sleep 60 + done + ''; + serviceConfig = { + Restart = "always"; + RestartSec = "10"; + User = "root"; # Root is required to execute nmcli radio commands and write to /var/log/ + }; + }; +} From 8228bd1f7252c75655e386031804e7dae7b58c82 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Tue, 26 May 2026 14:32:15 +0200 Subject: [PATCH 2/2] no simple sign up nextcloud (working?) --- system-modules/nx2site/nextcloud.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/system-modules/nx2site/nextcloud.nix b/system-modules/nx2site/nextcloud.nix index 61aa679..5c5ce5b 100644 --- a/system-modules/nx2site/nextcloud.nix +++ b/system-modules/nx2site/nextcloud.nix @@ -57,6 +57,7 @@ in { "mail_smtpauth" = true; "mail_smtpauthtype" = "LOGIN"; "mail_smtpname" = "nextcloud@${hyper.domain}"; + "simpleSignUpLink.shown" = false; }; secrets."mail_smtppassword" = config.sops.secrets."nx2site/smtp2go/nextcloud_api_key".path; # secrets.settings."mail_smtppassword" = config.sops.secrets."nx2site/maddy/nextcloud_password".path;