Compare commits

..
2 Commits
Author SHA1 Message Date
kiskaadee de02b19861 fix(nixos): include explicit POSIX ACL mask (m::rx) on 0700 home directories in tmpfiles
Core Architecture & Invariant CI / validate (push) Successful in 1m13s
Core Architecture & Invariant CI / validate (pull_request) Successful in 1m38s
- Add explicit mask m::rx and group homelab-operators traverse entry to systemd.tmpfiles.rules in nixos/modules/homeserver.nix so systemd-tmpfiles does not leave u:homelab-appctl:x masked out (#effective:---) on 0700 home directories
2026-11-15 22:40:58 -05:00
kiskaadee 99e9c130c0 fix(nixos): resolve writePython3Bin flake8 E501 build failure in dynu-ip-monitor
- Add flakeIgnore = [ "E501" ] to pkgs.writers.writePython3Bin in nixos/modules/dynu.nix
- Wrap lines >79 characters in nixos/scripts/monitor.py to satisfy Nix writer flake8 checks during toplevel system derivation builds
2026-11-15 22:22:54 -05:00
3 changed files with 18 additions and 8 deletions

No files matched your search

+3 -1
View File
@@ -7,7 +7,9 @@
let let
# Declaratively read the external Python script into the Nix store at evaluation time # Declaratively read the external Python script into the Nix store at evaluation time
ipMonitorScript = pkgs.writers.writePython3Bin "dynu-ip-monitor" { } (builtins.readFile ../scripts/monitor.py); ipMonitorScript = pkgs.writers.writePython3Bin "dynu-ip-monitor" {
flakeIgnore = [ "E501" ];
} (builtins.readFile ../scripts/monitor.py);
in in
{ {
# Define the keys to decrypt # Define the keys to decrypt
+3 -3
View File
@@ -243,9 +243,9 @@
"d /home/${config.homelab.operatorUser}/.local/state/homelab/gitops 0755 ${config.homelab.operatorUser} users -" "d /home/${config.homelab.operatorUser}/.local/state/homelab/gitops 0755 ${config.homelab.operatorUser} users -"
"d /home/${config.homelab.operatorUser}/.local/state/homelab/docker 0755 ${config.homelab.operatorUser} users -" "d /home/${config.homelab.operatorUser}/.local/state/homelab/docker 0755 ${config.homelab.operatorUser} users -"
"d /home/${config.homelab.operatorUser}/var/lib/homelab 0755 ${config.homelab.operatorUser} users -" "d /home/${config.homelab.operatorUser}/var/lib/homelab 0755 ${config.homelab.operatorUser} users -"
# POSIX ACLs granting homelab-appctl traverse and access to operator sites & homepage config # POSIX ACLs granting homelab-appctl and homelab-operators traverse & access (explicit mask m:: required on 0700 home dirs)
"a+ /home/${config.homelab.operatorUser} - - - - u:homelab-appctl:x" "a+ /home/${config.homelab.operatorUser} - - - - u:homelab-appctl:x,g:homelab-operators:x,m::rx"
"a+ ${config.homelab.coreDir} - - - - u:homelab-appctl:x" "a+ ${config.homelab.coreDir} - - - - u:homelab-appctl:x,g:homelab-operators:x,m::rx"
"A+ ${config.homelab.sitesDir} - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx" "A+ ${config.homelab.sitesDir} - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
"A+ /home/${config.homelab.operatorUser}/var/lib/homelab - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx" "A+ /home/${config.homelab.operatorUser}/var/lib/homelab - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
"A+ ${config.homelab.coreDir}/config/homepage - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx" "A+ ${config.homelab.coreDir}/config/homepage - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
+12 -4
View File
@@ -78,7 +78,8 @@ def get_public_ip():
for provider in PROVIDERS: for provider in PROVIDERS:
try: try:
req = urllib.request.Request( req = urllib.request.Request(
provider, headers={"User-Agent": "Mozilla/5.0 (NixOS WAN Monitor)"} provider,
headers={"User-Agent": "Mozilla/5.0 (NixOS WAN Monitor)"},
) )
# Fetch with 5s timeout to avoid hanging the systemd service # Fetch with 5s timeout to avoid hanging the systemd service
with urllib.request.urlopen(req, timeout=5) as response: with urllib.request.urlopen(req, timeout=5) as response:
@@ -91,7 +92,8 @@ def get_public_ip():
errors.append(f"{provider}: {e!s}") errors.append(f"{provider}: {e!s}")
print( print(
f"Error: All IP discovery providers failed. Details: {errors}", file=sys.stderr f"Error: All IP discovery providers failed. Details: {errors}",
file=sys.stderr,
) )
return None return None
@@ -128,7 +130,11 @@ def record_ip(ip, status, details=None):
Appends a new event entry into the JSONLines history registry. Appends a new event entry into the JSONLines history registry.
""" """
os.makedirs(os.path.dirname(HISTORY_FILE), exist_ok=True) os.makedirs(os.path.dirname(HISTORY_FILE), exist_ok=True)
entry = {"timestamp": datetime.now(tz=UTC).isoformat(), "ip": ip, "status": status} entry = {
"timestamp": datetime.now(tz=UTC).isoformat(),
"ip": ip,
"status": status,
}
if details: if details:
entry["details"] = details entry["details"] = details
try: try:
@@ -156,7 +162,9 @@ def trigger_ddclient():
if res.returncode == 0: if res.returncode == 0:
return True, None return True, None
else: else:
err_msg = f"systemctl exited with {res.returncode}: {res.stderr.strip()}" err_msg = (
f"systemctl exited with {res.returncode}: {res.stderr.strip()}"
)
return False, err_msg return False, err_msg
except (OSError, subprocess.SubprocessError) as e: except (OSError, subprocess.SubprocessError) as e:
return False, str(e) return False, str(e)