Yes, I’m writing a custom module that, when enabled, set the avahi-daemon.preStart property.
I was expecting something like the following fragment to work, however avahi-daemon does not peek up the custom.service
file
let
customXML = pkgs.writeText "custom.xml" ''
<?xml>
<service-group>
<name replace-wildcards="no">Custom Service</name>
<service>
<type>...</type>
<port>...</port>
</service>
</service-group>'';
in
{
# other stuff removed since unrelated
config = mkIf program.custom.enable {
systemd.services.avahi-daemon.preStart = ''
mkdir -p /etc/avahi/services
ln -sf ${customXML} /etc/avahi/services/custom.service
'';
}
The preStart
fragment in my module is appended to the default mkdir -p /var/run/avahi-daemon
.