Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/ed7fee4d-b50e-4387-8eb6-46840b9d930f Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
32 lines
883 B
Nix
32 lines
883 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
# ── Ensure njalla directory and base script exist on every build ──
|
|
systemd.tmpfiles.rules = [
|
|
"d /var/lib/njalla 0750 root root -"
|
|
];
|
|
|
|
# ── Create base njalla.sh if it doesn't exist yet ────────────
|
|
systemd.services.njalla-init = {
|
|
description = "Initialize Njal.la DDNS script if missing";
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
};
|
|
unitConfig = {
|
|
ConditionPathExists = "!/var/lib/njalla/njalla.sh";
|
|
};
|
|
script = ''
|
|
cat > /var/lib/njalla/njalla.sh <<'SCRIPT'
|
|
#!/usr/bin/env bash
|
|
IP=$(dig @resolver4.opendns.com myip.opendns.com +short -4)
|
|
|
|
## Add DDNS entries below — one curl per line
|
|
## Managed via Sovran Hub web interface
|
|
SCRIPT
|
|
|
|
chmod 700 /var/lib/njalla/njalla.sh
|
|
'';
|
|
};
|
|
} |