add unbound to server1
All checks were successful
nixos config pipeline / show-flake (push) Successful in 23s
nixos config pipeline / deploy (push) Successful in 55s

This commit is contained in:
smayzy 2025-08-28 14:23:39 +02:00
parent 65ffb35fd0
commit ffec6e9b29
3 changed files with 69 additions and 4 deletions

View File

@ -15,10 +15,17 @@
smayzy = { smayzy = {
server.enable = true; server.enable = true;
containers.nixos.httpd = { containers.nixos= {
enable = true; httpd = {
bridge = "br0"; enable = true;
ip = "192.168.1.201/24"; bridge = "br0";
ip = "192.168.1.201/24";
};
unbound = {
enable = true;
bridge = "br0";
ip = "192.168.1.202/24";
};
}; };
}; };

View File

@ -2,5 +2,6 @@
{ {
imports = [ imports = [
./httpd.nix ./httpd.nix
./unbound.nix
]; ];
} }

View File

@ -0,0 +1,57 @@
{ 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 ];
};
};
};
}