feat(dural): dedicated dns host
This commit is contained in:
parent
a612fa7194
commit
1569ae8ec3
4 changed files with 98 additions and 0 deletions
|
@ -50,5 +50,13 @@ in
|
||||||
inputs.nixos-hardware.nixosModules.raspberry-pi-4
|
inputs.nixos-hardware.nixosModules.raspberry-pi-4
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkSystem' {
|
||||||
|
hostname = "dural";
|
||||||
|
system = "x86_64-linux";
|
||||||
|
extraModules = [
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
];
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
64
hosts/dural/adguard.nix
Normal file
64
hosts/dural/adguard.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
cfg = config.services.adguardhome;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ cfg.settings.dns.port ];
|
||||||
|
|
||||||
|
services.adguardhome = {
|
||||||
|
enable = true;
|
||||||
|
port = 3000;
|
||||||
|
openFirewall = true;
|
||||||
|
settings = {
|
||||||
|
http = {
|
||||||
|
address = "127.0.0.1:${toString cfg.port}";
|
||||||
|
};
|
||||||
|
auth_attempts = 5;
|
||||||
|
block_auth_min = 10;
|
||||||
|
dns = {
|
||||||
|
bind_hosts = [ "0.0.0.0" ];
|
||||||
|
port = 53;
|
||||||
|
upstream_mode = "load_balance";
|
||||||
|
#upstream_dns_file = config.age.secrets.adguard-dns-list.path;
|
||||||
|
fallback_dns = [ "9.9.9.9" ];
|
||||||
|
};
|
||||||
|
clients = {
|
||||||
|
persistent = [
|
||||||
|
{
|
||||||
|
ids = [
|
||||||
|
"100.64.0.1"
|
||||||
|
"192.168.178.20"
|
||||||
|
];
|
||||||
|
name = "brontes";
|
||||||
|
tags = [ "device_pc" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ids = [
|
||||||
|
"100.64.0.2"
|
||||||
|
"192.168.178.53"
|
||||||
|
];
|
||||||
|
name = "oneplus9";
|
||||||
|
tags = [ "device_phone" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ids = [ "100.64.0.5" ];
|
||||||
|
name = "marr";
|
||||||
|
tags = [ "device_laptop" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ids = [ "100.64.0.4" ];
|
||||||
|
name = "shan";
|
||||||
|
tags = [ "device_pc" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
7
hosts/dural/default.nix
Normal file
7
hosts/dural/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./adguard.nix
|
||||||
|
./disko.nix
|
||||||
|
];
|
||||||
|
}
|
19
hosts/dural/disko.nix
Normal file
19
hosts/dural/disko.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib.my.disko) mkSwap mkBoot mkRoot;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
disko.devices.disk.builtin = {
|
||||||
|
device = "/dev/sda";
|
||||||
|
type = "disk";
|
||||||
|
imageSize = "16G";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = mkBoot "1G";
|
||||||
|
swap = mkSwap "4G";
|
||||||
|
root = mkRoot "100%" "ext4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue