switch to nixpkgs-fmt
This commit is contained in:
parent
8cd6ed1502
commit
c43341a8b2
69 changed files with 664 additions and 665 deletions
|
@ -1,41 +1,41 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.dadada.ddns;
|
||||
ddnsConfig = hostNames: {
|
||||
systemd.timers = listToAttrs (forEach hostNames (hostname:
|
||||
nameValuePair "ddns-${hostname}"
|
||||
{
|
||||
wantedBy = ["timers.target"];
|
||||
partOf = ["ddns-${hostname}.service"];
|
||||
timerConfig.OnCalendar = "hourly";
|
||||
}));
|
||||
{
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "ddns-${hostname}.service" ];
|
||||
timerConfig.OnCalendar = "hourly";
|
||||
}));
|
||||
|
||||
systemd.services = listToAttrs (forEach hostNames (hostname:
|
||||
nameValuePair "ddns-${hostname}"
|
||||
{
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
function url() {
|
||||
echo "https://svc.joker.com/nic/update?username=$1&password=$2&hostname=$3"
|
||||
}
|
||||
{
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
function url() {
|
||||
echo "https://svc.joker.com/nic/update?username=$1&password=$2&hostname=$3"
|
||||
}
|
||||
|
||||
IFS=':'
|
||||
read -r user password < /var/lib/ddns/credentials
|
||||
unset IFS
|
||||
IFS=':'
|
||||
read -r user password < /var/lib/ddns/credentials
|
||||
unset IFS
|
||||
|
||||
curl_url=$(url "$user" "$password" ${hostname})
|
||||
curl_url=$(url "$user" "$password" ${hostname})
|
||||
|
||||
${pkgs.curl}/bin/curl -4 "$curl_url"
|
||||
${pkgs.curl}/bin/curl -6 "$curl_url"
|
||||
'';
|
||||
}));
|
||||
${pkgs.curl}/bin/curl -4 "$curl_url"
|
||||
${pkgs.curl}/bin/curl -6 "$curl_url"
|
||||
'';
|
||||
}));
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
dadada.ddns.domains = mkOption {
|
||||
type = types.listOf types.str;
|
||||
|
@ -45,7 +45,7 @@ in {
|
|||
example = ''
|
||||
[ "example.com" ]
|
||||
'';
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue