From c927cee2c3ad9b205a18535301a9ca7a3c484c95 Mon Sep 17 00:00:00 2001 From: Wout Mertens Date: Mon, 12 May 2014 15:03:42 +0200 Subject: [PATCH] dhcpcd: Allow adding hook code --- nixos/modules/services/networking/dhcpcd.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index 8799d7d8a20..5a353fc0942 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -57,6 +57,8 @@ let #if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then # ${config.systemd.package}/bin/systemctl start ip-down.target #fi + + ${config.networking.dhcpcd.runHook} ''; in @@ -86,6 +88,16 @@ in ''; }; + networking.dhcpcd.runHook = mkOption { + type = types.lines; + default = ""; + example = "if [[ $reason =~ BOUND ]]; then echo $interface: Routers are $new_routers - were $old_routers; fi"; + description = '' + Shell code that will be run after all other hooks. See + `man dhcpcd-run-hooks` for details on what is possible. + ''; + }; + };