From 3f377cfde86a845a968bf9c1e173fef11eff6ab1 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Wed, 2 Jul 2025 04:03:14 -0700 Subject: [PATCH] nixos/avahi-daemon: add dependency to ensure `/run/avahi-daemon` is created before socket activation (#417635) --- nixos/modules/services/networking/avahi-daemon.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix index 3ba61a6598ad..ab54eafb6877 100644 --- a/nixos/modules/services/networking/avahi-daemon.nix +++ b/nixos/modules/services/networking/avahi-daemon.nix @@ -323,6 +323,11 @@ in description = "Avahi mDNS/DNS-SD Stack Activation Socket"; listenStreams = [ "/run/avahi-daemon/socket" ]; wantedBy = [ "sockets.target" ]; + after = [ + # Ensure that `/run/avahi-daemon` owned by `avahi` is created by `systemd.tmpfiles.rules` before the `avahi-daemon.socket`, + # otherwise `avahi-daemon.socket` will automatically create it owned by `root`, which will cause `avahi-daemon.service` to fail. + "systemd-tmpfiles-setup.service" + ]; }; systemd.tmpfiles.rules = [ "d /run/avahi-daemon - avahi avahi -" ];