Merge branch 'master' of ssh://ssh.nx2.site:50022/nx2/dotfiles
This commit is contained in:
@@ -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;
|
||||
|
||||
36
system-modules/stay-up.nix
Normal file
36
system-modules/stay-up.nix
Normal file
@@ -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/
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user