refactor(dyndns): move dyndns config into own module
This commit is contained in:
@@ -2,21 +2,17 @@
|
|||||||
inputs,
|
inputs,
|
||||||
outputs,
|
outputs,
|
||||||
config,
|
config,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
dyndnsScript = pkgs.writeScript "dyndns.py" (builtins.readFile ./dyndns.py);
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(import ../base.nix { inherit inputs outputs; })
|
(import ../base.nix { inherit inputs outputs; })
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./secrets
|
|
||||||
inputs.agenix.nixosModules.default
|
inputs.agenix.nixosModules.default
|
||||||
|
./secrets
|
||||||
|
./dyndns.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
users.groups.dyndns = { };
|
|
||||||
users.users = {
|
users.users = {
|
||||||
leonhard = {
|
leonhard = {
|
||||||
initialPassword = "leonhard";
|
initialPassword = "leonhard";
|
||||||
@@ -24,31 +20,6 @@ in
|
|||||||
extraGroups = [ "wheel" ];
|
extraGroups = [ "wheel" ];
|
||||||
openssh.authorizedKeys.keys = config.kekleo.publicKeys;
|
openssh.authorizedKeys.keys = config.kekleo.publicKeys;
|
||||||
};
|
};
|
||||||
dyndns = {
|
|
||||||
isSystemUser = true;
|
|
||||||
group = "dyndns";
|
|
||||||
packages = [ pkgs.python313Packages.nc-dnsapi ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.timers."dyndns" = {
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
OnBootSec = "5m";
|
|
||||||
OnUnitActiveSec = "5m";
|
|
||||||
Unit = "dyndns.service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services."dyndns" = {
|
|
||||||
script = ''
|
|
||||||
set -eu
|
|
||||||
${pkgs.python313}/bin/python3 ${dyndnsScript}
|
|
||||||
'';
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
User = "dyndns";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
users.groups.dyndns = { };
|
||||||
|
users.users.dyndns = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "dyndns";
|
||||||
|
createHome = true;
|
||||||
|
home = /var/dyndns;
|
||||||
|
packages = [ pkgs.python313Packages.nc-dnsapi ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers."dyndns" = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = "5m";
|
||||||
|
OnUnitActiveSec = "5m";
|
||||||
|
Unit = "dyndns.service";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services."dyndns" = {
|
||||||
|
script = ''
|
||||||
|
python3 -c "${builtins.readFile ./dyndns.py}"
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = "dyndns";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user