networking.dhcpcd.runHook

Shell code that will be run after all other hooks. See man dhcpcd-run-hooks for details on what is possible.

To use sudo or similar tools in your script you may have to set:

networking.dhcpcd.allowSetuid = true;

In addition, as most of the filesystem is inaccessible to dhcpcd by default, you may want to define some exceptions, e.g.

systemd.services.dhcpcd.serviceConfig.ReadOnlyPaths = [
  "/run/user/1000/bus"  # to send desktop notifications
];
Type
strings concatenated with "\n"
Default
""
Example
"if [[ $reason =~ BOUND ]]; then echo $interface: Routers are $new_routers - were $old_routers; fi"
Declared
<nixpkgs/nixos/modules/services/networking/dhcpcd.nix>