nixos/avahi: Add package option
Allows replacing the avahi package (e.g. for debugging) without having to use an overlay, avoiding unnecessary package rebuilds.
This commit is contained in:
parent
6672dde558
commit
af614b53d1
1 changed files with 13 additions and 4 deletions
|
@ -56,6 +56,15 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.avahi;
|
||||
defaultText = literalExpression "pkgs.avahi";
|
||||
description = lib.mdDoc ''
|
||||
The avahi package to use for running the daemon.
|
||||
'';
|
||||
};
|
||||
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
default = config.networking.hostName;
|
||||
|
@ -260,7 +269,7 @@ in
|
|||
(mkAfter [ "mdns" ]) # after dns
|
||||
]);
|
||||
|
||||
environment.systemPackages = [ pkgs.avahi ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
environment.etc = (mapAttrs'
|
||||
(n: v: nameValuePair
|
||||
|
@ -286,19 +295,19 @@ in
|
|||
# return a sensible value.
|
||||
environment.LD_LIBRARY_PATH = config.system.nssModules.path;
|
||||
|
||||
path = [ pkgs.coreutils pkgs.avahi ];
|
||||
path = [ pkgs.coreutils cfg.package ];
|
||||
|
||||
serviceConfig = {
|
||||
NotifyAccess = "main";
|
||||
BusName = "org.freedesktop.Avahi";
|
||||
Type = "dbus";
|
||||
ExecStart = "${pkgs.avahi}/sbin/avahi-daemon --syslog -f ${avahiDaemonConf}";
|
||||
ExecStart = "${cfg.package}/sbin/avahi-daemon --syslog -f ${avahiDaemonConf}";
|
||||
ConfigurationDirectory = "avahi/services";
|
||||
};
|
||||
};
|
||||
|
||||
services.dbus.enable = true;
|
||||
services.dbus.packages = [ pkgs.avahi ];
|
||||
services.dbus.packages = [ cfg.package ];
|
||||
|
||||
networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ 5353 ];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue