# nixos-config - My current NixOS configuration # # Copyright (C) 2025 Benedikt Peetz # SPDX-License-Identifier: GPL-3.0-or-later # # This file is part of my nixos-config. # # You should have received a copy of the License along with this program. # If not, see . { lib, config, pkgs, ... }: let cfg = config.vhack.unbound; in { options.vhack.unbound = { enable = lib.mkEnableOption "local unbound, a resolving dns server"; }; config = lib.mkIf cfg.enable { vhack.persist.directories = [ { directory = "/var/lib/unbound"; user = "unbound"; group = "unbound"; mode = "0700"; } ]; services.unbound = { enable = true; stateDir = "/var/lib/unbound"; resolveLocalQueries = true; settings = { server = { hide-identity = true; hide-version = true; harden-glue = true; harden-dnssec-stripped = true; # 0x20-encoded randomization use-caps-for-id = true; # DNSSEC - enabled by default with auto-trust-anchor-file # auto-trust-anchor-file = "/var/lib/unbound/root.key"; }; }; }; users = { users = { unbound = { uid = config.vhack.constants.ids.uids.unbound; group = "unbound"; }; }; groups = { unbound = { gid = config.vhack.constants.ids.gids.unbound; }; }; }; }; }