New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos ddclient: support multiple domains and run via systemd timer #36864
Conversation
Success on x86_64-linux (full log) Attempted: ddclient Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: ddclient Partial log (click to expand)
|
@@ -25,7 +26,12 @@ buildPerlPackage rec { | |||
''; | |||
|
|||
installPhase = '' | |||
runHook preInstall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's better to change installPhase to postInstall, so the hooks don't have to be invoked manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how this is more explicit - everything that happens for the install happens here.
Is there a "recommended pattern"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's written down, but I think it's recommended to not override the phases directly, but rather add stuff to pre/post. It's easy to forget to invoke the hooks. (As evidenced by this expression that you're fixing now.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is, this is the installation phase. From the perspective of "least surprising behaviour" I would assume installation is done in the installPhase
. If we do this in postInstall
instead, somebody cannot override that phase without not having anything installed.
I fully understand where you're coming from though - when people start messing with phases
directly there is a high chance of someone breaking things or accidentally leaving out phases that should be run. But in this case this is actually doing the right thing (IMHO).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
type = str; | ||
description = '' | ||
The interval at which to run the check and update. | ||
See <command>man 7 systemd.time</command> for the format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of
See <command>man 7 systemd.time</command> for the format.
it is nicer to directly reference the document:
See
<citerefentry>
<refentrytitle>systemd.time</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
for the format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
a) Some providers can update multiple domains - support that. b) Make "zone" and "script" configurable. Some providers require these. c) Instead of leaving the ddclient daemon running all the time, use a systemd timer to kick it off. d) Don't use a predefined user - run everything via DynamicUser e) Add documentation
Been running with this for a month or so. |
Motivation for this change
Some providers can handle multiple domains so add support for that.
Additionally, ddclient will by default run all the time and then do its thing at an interval. The interval is quite short by default (10 minutes) but if someone was increase that to half a day (as an example) it would be pointless to leave the ddclient running for the entire time. Instead we just let systemd handle the timing.
Running with this set-up here - so far it looks good.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)