about summary refs log tree commit diff
path: root/modules/services/avahi/default.nix
blob: 3a6eb58a81ebdfe00e00a829b22be3cbd9509120 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ config, pkgs, lib, ... }:
let cfg = config.my.services.avahi;
in
{
  options.my.services.avahi = with lib; {
    enable = mkEnableOption "avahi service";
    withReflector = mkEnableOption "enable reflector";
    interfaces = mkOption {
      type = types.nullOr (types.listOf types.str);
      default = null;
      description = "List of network interfaces that should be used by the {command}`avahi-daemon`.";
    };
  };

  config = lib.mkIf cfg.enable {
    services.avahi.enable = true;
    # Important to resolve .local domains of printers, otherwise you get an error
    # like  "Impossible to connect to XXX.local: Name or service not known"
    services.avahi.nssmdns = true;

    services.avahi.reflector = cfg.withReflector;
    services.avahi.interfaces = cfg.interfaces;
  };
}