dotfiles/modules/nixos/quirks/avahi.nix
Christopher Mühl 786af32daf
Publish my config
This is the result of ~100 commits to my NixOS config. Since I haven't
always used `agenix-rekey`, this is another initial commit so that none
of the secrets in my git history are leaked
2025-07-30 23:36:39 +02:00

42 lines
960 B
Nix

{
config,
lib,
pkgs,
modulesPath,
...
}: {
config = lib.mkIf (builtins.elem "avahi" config.elements.quirks) {
services = {
# Name Server Caching Daemon
nscd = {
enable = true;
enableNsncd = true;
};
# Avahi mDNS service discovery
avahi = {
enable = true;
# Due to some quirk this has to stay disabled. Instead, we have to specify
# system.nssModules = [pkgs.nssmdns];
nssmdns4 = false;
ipv6 = false;
publish = {
enable = true;
addresses = true;
domain = true;
userServices = true;
workstation = true;
};
};
};
system = {
nssModules = [pkgs.nssmdns];
# This order is required for avahi to work (uses mdns4 rather than mdns_minimal).
nssDatabases.hosts = lib.mkForce ["files myhostname mdns4 [NOTFOUND=return] resolve [!UNAVAIL=return] dns"];
};
};
}