Skip to content

Networkd dispatcher

services.networkd-dispatcher.enable

Whether to enable Networkd-dispatcher service for systemd-networkd connection status change. See upstream instructions for usage . Type: boolean

Default

false

Example

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/networking/networkd-dispatcher.nix

services.networkd-dispatcher.rules

Declarative configuration of networkd-dispatcher rules. See upstream instructions for an introduction and example scripts.

Type: attribute set of (submodule)

Default

{ }

Example

{ "restart-tor" = {onState = ["routable" "off"];script = '' #!${pkgs.runtimeShell} if [[ $IFACE == "wlan0" && $AdministrativeState == "configured" ]]; then echo "Restarting Tor ..." systemctl restart tor fi exit 0 '';};};

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/networking/networkd-dispatcher.nix

services.networkd-dispatcher.rules.<name>.onState

List of names of the systemd-networkd operational states which should trigger the script. See https://www.freedesktop.org/software/systemd/man/networkctl.html for a description of the specific state type.

Type: list of (one of "routable", "dormant", "no-carrier", "off", "carrier", "degraded", "configuring", "configured")

Default

null

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/networking/networkd-dispatcher.nix

services.networkd-dispatcher.rules.<name>.script

Shell commands executed on specified operational states.

Type: strings concatenated with "\n"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/networking/networkd-dispatcher.nix