mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
ddns-updater: Add module, test, update script
This commit is contained in:
parent
28459ba216
commit
61820de2d4
@ -29,6 +29,8 @@
|
||||
|
||||
- [Radicle](https://radicle.xyz), an open source, peer-to-peer code collaboration stack built on Git. Available as [services.radicle](#opt-services.radicle.enable).
|
||||
|
||||
- [ddns-updater](https://github.com/qdm12/ddns-updater), a service to update DNS records periodically with WebUI for many DNS providers. Available as [services.ddns-updater](#opt-services.ddns-updater.enable).
|
||||
|
||||
- [Renovate](https://github.com/renovatebot/renovate), a dependency updating tool for various git forges and language ecosystems. Available as [services.renovate](#opt-services.renovate.enable).
|
||||
|
||||
- [wg-access-server](https://github.com/freifunkMUC/wg-access-server/), an all-in-one WireGuard VPN solution with a web ui for connecting devices. Available at [services.wg-access-server](#opt-services.wg-access-server.enable).
|
||||
|
@ -991,6 +991,7 @@
|
||||
./services/networking/dante.nix
|
||||
./services/networking/deconz.nix
|
||||
./services/networking/ddclient.nix
|
||||
./services/networking/ddns-updater.nix
|
||||
./services/networking/dhcpcd.nix
|
||||
./services/networking/dnscache.nix
|
||||
./services/networking/dnscrypt-proxy2.nix
|
||||
|
46
nixos/modules/services/networking/ddns-updater.nix
Normal file
46
nixos/modules/services/networking/ddns-updater.nix
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.ddns-updater;
|
||||
in
|
||||
{
|
||||
options.services.ddns-updater = {
|
||||
enable = lib.mkEnableOption "Container to update DNS records periodically with WebUI for many DNS providers";
|
||||
|
||||
package = lib.mkPackageOption pkgs "ddns-updater" { };
|
||||
|
||||
environment = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
description = "Environment variables to be set for the ddns-updater service. DATADIR is ignored to enable using systemd DynamicUser. For full list see https://github.com/qdm12/ddns-updater";
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
systemd.services.ddns-updater = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
environment = cfg.environment // {
|
||||
DATADIR = "%S/ddns-updater";
|
||||
};
|
||||
unitConfig = {
|
||||
Description = "DDNS-updater service";
|
||||
};
|
||||
serviceConfig = {
|
||||
TimeoutSec = "5min";
|
||||
ExecStart = lib.getExe cfg.package;
|
||||
RestartSec = 30;
|
||||
DynamicUser = true;
|
||||
StateDirectory = "ddns-updater";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -245,6 +245,7 @@ in {
|
||||
davis = handleTest ./davis.nix {};
|
||||
db-rest = handleTest ./db-rest.nix {};
|
||||
dconf = handleTest ./dconf.nix {};
|
||||
ddns-updater = handleTest ./ddns-updater.nix {};
|
||||
deconz = handleTest ./deconz.nix {};
|
||||
deepin = handleTest ./deepin.nix {};
|
||||
deluge = handleTest ./deluge.nix {};
|
||||
|
28
nixos/tests/ddns-updater.nix
Normal file
28
nixos/tests/ddns-updater.nix
Normal file
@ -0,0 +1,28 @@
|
||||
import ./make-test-python.nix (
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
port = 6000;
|
||||
in
|
||||
{
|
||||
name = "ddns-updater";
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ delliott ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.ddns-updater = {
|
||||
enable = true;
|
||||
environment = {
|
||||
LISTENING_ADDRESS = ":" + (toString port);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("ddns-updater.service")
|
||||
machine.wait_for_open_port(${toString port})
|
||||
machine.succeed("curl --fail http://localhost:${toString port}/")
|
||||
'';
|
||||
}
|
||||
)
|
@ -1,7 +1,9 @@
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
nixosTests,
|
||||
nix-update-script,
|
||||
}:
|
||||
buildGoModule rec {
|
||||
pname = "ddns-updater";
|
||||
@ -23,6 +25,13 @@ buildGoModule rec {
|
||||
|
||||
subPackages = [ "cmd/updater" ];
|
||||
|
||||
passthru = {
|
||||
tests = {
|
||||
inherit (nixosTests) ddns-updater;
|
||||
};
|
||||
updateScript = nix-update-script { };
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
mv $out/bin/updater $out/bin/ddns-updater
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user