feat: add dns container with AGH + unbound

This commit is contained in:
Xavier Morel
2025-10-23 22:13:43 +02:00
parent 0d343b12a3
commit 16b9271caf
6 changed files with 210 additions and 2 deletions

41
lxc/dns.nix Normal file
View File

@@ -0,0 +1,41 @@
{
pkgs,
name,
containersMapping,
...
}:
let
hostname = pkgs.lib.removeSuffix ".nix" name;
infra = import ../lib/constants.nix;
container_id = containersMapping.${hostname};
ip = infra.build_ip container_id;
domainname = "${hostname}${infra.domains.internal}";
in
{
cores = 2;
memory = "2G";
disk = "4G";
swap = 512;
ports = [
80
53
12345
];
exposed = false;
services = {
adguardhome = import ./dns/adguardhome-config.nix { inherit infra ip domainname; };
unbound = {
enable = true;
};
};
logging.enable = true;
logging.metrics.enable = true;
etc."alloy/logs-adguard.alloy".text =
(import ./dns/logs-adguard.alloy.nix {
inherit ip domainname;
}).out;
etc."alloy/logs-unbound.alloy".text =
(import ./dns/logs-unbound.alloy.nix {
inherit ip domainname;
}).out;
}