nix-config/modules/nix/containers/nixos/unbound.nix
smayzy ffec6e9b29
All checks were successful
nixos config pipeline / show-flake (push) Successful in 23s
nixos config pipeline / deploy (push) Successful in 55s
add unbound to server1
2025-08-28 14:23:39 +02:00

58 lines
1.5 KiB
Nix

{ lib, config, ... }:
let
inherit (lib) mkIf mkOption types;
cfg = config.smayzy.containers.nixos.unbound;
in
{
options.smayzy.containers.nixos.unbound = {
enable = mkOption {
type = types.bool;
default = false;
description = "unbound nixos ct";
};
bridge = mkOption {
type = types.str;
description = "the bridge to use e.g. (br0)";
};
ip = mkOption {
type = types.str;
description = "ip addr e.g. (192.168.1.20)";
};
};
config = mkIf cfg.enable {
containers.unbound = {
autoStart = true;
privateNetwork = true;
hostBridge = cfg.bridge;
localAddress = cfg.ip;
config = { ... }: {
system.stateVersion = "25.11";
services.unbound = {
enable = true;
settings = {
server = {
interface = [ "0.0.0.0" ];
qname-minimisation = "yes";
access-control = [
"127.0.0.0/8 allow"
"192.168.0.0/16 allow"
];
local-zone = [ "internal.smayzy.ovh. static" ];
local-data = [
''"npm-local.internal.smayzy.ovh. A 192.168.1.181"''
''"npm.internal.smayzy.ovh. A 192.168.1.200"''
''"qbittorrent.internal.smayzy.ovh. CNAME npm-local.internal.smayzy.ovh."''
];
};
};
};
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];
};
};
};
}