1 { config, lib, pkgs, ... }:
6 cfg = config.services.blocky;
8 format = pkgs.formats.yaml { };
9 configFile = format.generate "config.yaml" cfg.settings;
12 options.services.blocky = {
13 enable = mkEnableOption (lib.mdDoc "blocky, a fast and lightweight DNS proxy as ad-blocker for local network with many features");
18 description = lib.mdDoc ''
19 Blocky configuration. Refer to
20 <https://0xerr0r.github.io/blocky/configuration/>
21 for details on supported values.
26 config = mkIf cfg.enable {
27 systemd.services.blocky = {
28 description = "A DNS proxy and ad-blocker for the local network";
29 wantedBy = [ "multi-user.target" ];
33 ExecStart = "${pkgs.blocky}/bin/blocky --config ${configFile}";
35 AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
36 CapabilityBoundingSet = [ "CAP_NET_BIND_SERVICE" ];