Files
nixos-core/infra/nixos/dynu-ddns.nix
T
kiskaadee ef72e3ea0f refactor(core): decouple applications to separate deployments and streamline core control plane
This commit restructures the homeserver repository to isolate the core gateway and management tools (Control Plane) from user applications (Data Plane). This allows applications to have independent lifecycles and CI/CD pipelines, preventing git history contamination.

- Relocated user applications (excalidraw, gitea, jellyfin, learning-hub, mermaid, ollama) to an external deployments directory.
- Moved homepage to the root directory as a core server component and removed the empty apps directory.
- Streamlined up.sh and down.sh to deploy and stop only core services and homepage, removing --infra-only parameters.
- Replaced all hardcoded domain names with a configurable global DOMAIN environment variable in docker-compose files.
- Used Authelia templating ({{ env "DOMAIN" }}) in configuration.yml to dynamically resolve SSO cookie domains and redirection URLs.
- Updated up.sh and down.sh helpers to explicitly pass env files via --env-file flags, resolving compose interpolation warnings.
- Created a declarative NixOS module (infra/nixos/dynu-ddns.nix) to orchestrate the Dynu DDNS update script.
- Created Authelia .env-example template for setup reproducibility.
- Refactored .gitignore to exclude obsolete app cache rules and keep it minimal to core secrets, volumes, and logs.
- Updated documentation (README, architecture, roadmap, usability) to document decoupled deployments and public/SSO service templates.
2026-06-14 23:33:35 -05:00

79 lines
2.0 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.dynu-ddns;
in {
options.services.dynu-ddns = {
enable = mkEnableOption "Dynu DDNS IP monitor and updater service";
scriptPath = mkOption {
type = types.path;
default = ../../scripts/dynu/ip-monitor.sh;
description = "Path to the ip-monitor.sh script.";
};
environmentFile = mkOption {
type = types.path;
default = /etc/conf.d/dynu-environment;
description = ''
Path to the environment file containing the Dynu credentials.
The file must define:
DYNU_HOST=your-domain.mywire.org
DYNU_USER=your-dynu-username
DYNU_PASSWORD=your-dynu-password
'';
};
interval = mkOption {
type = types.str;
default = "5min";
description = "Interval at which to run the updater service.";
};
};
config = mkIf cfg.enable {
systemd.services.dynu-ddns = {
description = "Dynu IP Monitor & Updater";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
path = with pkgs; [
bash
curl
coreutils
dnsutils # provides dig
util-linux # provides flock
gawk
];
serviceConfig = {
Type = "oneshot";
User = "root";
Group = "root";
StateDirectory = "dynu";
EnvironmentFile = cfg.environmentFile;
ExecStart = "${pkgs.bash}/bin/bash ${cfg.scriptPath}";
TimeoutSec = 30;
# Hardening
NoNewPrivileges = true;
PrivateTmp = true;
ProtectSystem = "strict";
ProtectHome = true;
ReadWritePaths = "/var/lib/dynu";
};
};
systemd.timers.dynu-ddns = {
description = "Run Dynu updater periodically";
timerConfig = {
OnBootSec = "30s";
OnUnitActiveSec = cfg.interval;
AccuracySec = "10s";
Persistent = true;
};
wantedBy = [ "timers.target" ];
};
};
}