ref: refactor service configuration

This commit is contained in:
Katharina Heidenreich 2026-03-13 19:43:15 +01:00
parent a5530c31a9
commit 0f3ccffd4d
3 changed files with 12 additions and 69 deletions

View file

@ -22,14 +22,7 @@ in {
imports = [
"${fetchTarball "https://github.com/NixOS/nixos-hardware/archive/${nixosHardwareVersion}.tar.gz"}/raspberry-pi/4"
./network/static-ip.nix
./services/openssh.nix
#./services/blocky.nix #dns
./services/unbound.nix #dns
./services/kea.nix #dhcp
./services/nginx.nix #reverse proxy
./services/qbittorrent.nix #torrent
./services/kiwix.nix #wiki mirror
./services/kiwix-updater.nix #wiki mirror update
./services
./users
./programs
];

View file

@ -1,61 +0,0 @@
{ config, pkgs, ... }:
let
net = import ../data/network.nix;
in
{
# Enable Blocky
services.blocky = {
enable = true;
settings = {
# Listen on port 53 (standard DNS port)
ports.dns = 53;
# Custom DNS entries for your local services
customDNS = {
# This maps your domains to your Pi's IP
mapping = net.dnsMappings;
# mapping = dnsMappings;
};
conditional = {
fallbackUpstream = false;
mapping = builtins.mapAttrs (name: value: net.ips.router) net.dnsMappings;
};
# Upstream DNS servers (with fallback)
upstreams = {
groups = {
default =
["https://cloudflare-dns.com/dns-query"] ++ net.fallback_dns_servers;
};
};
# Bootstrap DNS (for initially resolving DoH servers)
bootstrapDns = {
upstream = "https://1.1.1.1/dns-query";
ips = ["1.1.1.1" "1.0.0.1"];
};
# Enable caching for better performance
caching = {
minTime = "5m";
maxTime = "30m";
prefetching = true;
};
# blocking = {
# denylists = {
# ads = ["https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"];
# };
# clientGroupsBlock = {
# default = ["ads"];
# };
# };
};
};
# Allow DNS through the firewall
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];
}

11
services/default.nix Normal file
View file

@ -0,0 +1,11 @@
{...}: {
imports = [
./kea.nix
./kiwix-updater.nix
./kiwix.nix
./nginx.nix
./openssh.nix
./qbittorent.nix
./unbound.nix
];
}