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