update intellij, add hosts file

This commit is contained in:
Kopatz
2025-10-14 09:49:47 +02:00
parent a3ca07d7fb
commit 6f1340f2f6
4 changed files with 102 additions and 85 deletions

View File

@@ -1,5 +1,7 @@
{ config, pkgs, inputs, lib, ... }:
let cfg = config.custom.services.adguard;
ip = cfg.ip;
wireguardIp = config.custom.services.wireguard.ip;
in {
options.custom.services.adguard = {
enable = lib.mkEnableOption "Enables adguard";
@@ -23,87 +25,9 @@ in {
default = "https://127.0.0.1:8443/acme/kop-acme/directory";
description = "acme url for the adguard instance";
};
};
config =
let
ip = cfg.ip;
wireguardIp = config.custom.services.wireguard.ip;
in
lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];
security.acme.certs."${cfg.fqdn}".server = cfg.acme-url;
# nginx reverse proxy
services.nginx.enable = true;
services.nginx.virtualHosts.${cfg.fqdn} = {
forceSSL = cfg.useHttps;
enableACME = cfg.useHttps;
locations."/" = {
proxyPass =
"http://127.0.0.1:${toString config.services.adguardhome.port}";
proxyWebsockets = true;
};
};
systemd.services.adguardhome = {
after = [ "nginx.service" "step-ca.service" ];
};
services.adguardhome = {
enable = true;
settings = {
schema_version = 28;
users = [{
name = "admin";
password =
"$2y$15$iPzjmUJPTwWUOsDp46GOPO/LYor/jDJjndwy2QlPddaKSD4QXvq9W";
}];
dns = {
bind_hosts = [ "127.0.0.1" ip ] ++ lib.lists.optionals config.custom.services.wireguard.enable [ wireguardIp ];
port = 53;
protection_enabled = true;
filtering_enabled = true;
upstream_dns = [
#"https://dns10.quad9.net/dns-query" slow
"quic://dns.adguard-dns.com"
#"tls://noads.libredns.gr" slow
"https://noads.joindns4.eu/dns-query"
"tls://getdnsapi.net"
];
fallback_dns = [
"1.1.1.1"
"1.0.0.1"
];
use_http3_upstreams = true;
};
querylog = { enabled = false; };
filters = [
{
enabled = true;
url =
"https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt";
name = "adguard dns list";
id = 1;
}
{
enabled = true;
url =
"https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt";
name = "adguard block list";
id = 2;
}
{
enabled = true;
url = "https://dbl.oisd.nl/";
name = "big block list";
id = 3;
}
];
dhcp = { enabled = false; };
tls = { enabled = false; };
filtering = {
rewrites = [
{
rewrites = lib.mkOption {
type = lib.types.listOf (lib.types.attrsOf lib.types.str);
default = [ {
"domain" = "kopatz.ddns.net";
"answer" = ip;
}
@@ -190,8 +114,89 @@ in {
{
"domain" = "inverter.home.arpa";
"answer" = "192.168.0.9";
}
}];
description = "list of domains to rewrite to this server's ip";
};
};
config =
#let
# ip = cfg.ip;
# wireguardIp = config.custom.services.wireguard.ip;
#in
lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];
security.acme.certs."${cfg.fqdn}".server = cfg.acme-url;
# nginx reverse proxy
services.nginx.enable = true;
services.nginx.virtualHosts.${cfg.fqdn} = {
forceSSL = cfg.useHttps;
enableACME = cfg.useHttps;
locations."/" = {
proxyPass =
"http://127.0.0.1:${toString config.services.adguardhome.port}";
proxyWebsockets = true;
};
};
systemd.services.adguardhome = {
after = [ "nginx.service" "step-ca.service" ];
};
services.adguardhome = {
enable = true;
settings = {
schema_version = 28;
users = [{
name = "admin";
password =
"$2y$15$iPzjmUJPTwWUOsDp46GOPO/LYor/jDJjndwy2QlPddaKSD4QXvq9W";
}];
dns = {
bind_hosts = [ "127.0.0.1" ip ] ++ lib.lists.optionals config.custom.services.wireguard.enable [ wireguardIp ];
port = 53;
protection_enabled = true;
filtering_enabled = true;
upstream_dns = [
#"https://dns10.quad9.net/dns-query" slow
"quic://dns.adguard-dns.com"
#"tls://noads.libredns.gr" slow
"https://noads.joindns4.eu/dns-query"
"tls://getdnsapi.net"
];
fallback_dns = [
"1.1.1.1"
"1.0.0.1"
];
use_http3_upstreams = true;
};
querylog = { enabled = false; };
filters = [
{
enabled = true;
url =
"https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt";
name = "adguard dns list";
id = 1;
}
{
enabled = true;
url =
"https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt";
name = "adguard block list";
id = 2;
}
{
enabled = true;
url = "https://dbl.oisd.nl/";
name = "big block list";
id = 3;
}
];
dhcp = { enabled = false; };
tls = { enabled = false; };
filtering = {
rewrites = cfg.rewrites;
};
};
};