1
0
mirror of https://github.com/tboerger/nixos-config synced 2024-11-22 18:21:58 +01:00
github.com-tboerger-nixos-c.../shared/services/homedns.nix

90 lines
1.6 KiB
Nix
Raw Normal View History

2022-10-25 09:53:40 +02:00
{ pkgs, lib, config, options, fetchurl, ... }:
with lib;
let
cfg = config.personal.services.homedns;
2022-10-25 09:53:40 +02:00
in
{
options = {
personal = {
services = {
homedns = {
enable = mkEnableOption "HomeDNS";
2022-10-25 09:53:40 +02:00
};
};
};
};
config = mkIf cfg.enable {
services = {
adguardhome = {
enable = true;
mutableSettings = false;
settings = {
bind_host = "127.0.0.1";
bind_port = 3000;
dhcp = {
enabled = false;
};
2022-10-25 09:53:40 +02:00
dns = {
bind_host = "0.0.0.0";
bind_port = 53;
2022-11-10 16:10:58 +01:00
bootstrap_dns = [
"1.1.1.1"
"8.8.8.8"
];
2022-10-25 09:53:40 +02:00
upstream_dns = [
"1.1.1.1"
"8.8.8.8"
];
};
users = [{
name = "admin";
password = "$2y$05$wzuDDF0NaP0zX.gguP8EyuBJ1wlyTPjLvXf.LCK8VCBKIUq4PnR62";
}];
};
};
nginx = {
virtualHosts =
let
base = locations: {
inherit locations;
useACMEHost = "boerger.ws";
forceSSL = true;
};
proxy = port: base {
"/" = {
proxyPass = "http://127.0.0.1:" + toString (port) + "/";
proxyWebsockets = true;
};
};
in
{
"adguard.boerger.ws" = proxy 3000;
};
};
2022-10-25 09:53:40 +02:00
};
personal = {
services = {
acme = {
2022-10-25 09:53:40 +02:00
enable = true;
};
2022-10-25 09:53:40 +02:00
webserver = {
enable = true;
2022-10-25 09:53:40 +02:00
};
};
};
};
}