summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/bird.nix1
-rw-r--r--nixos/modules/services/networking/dnscrypt-proxy.xml8
-rw-r--r--nixos/modules/services/networking/networkmanager.nix29
3 files changed, 32 insertions, 6 deletions
diff --git a/nixos/modules/services/networking/bird.nix b/nixos/modules/services/networking/bird.nix
index 9f08cc0a79ed..555733aab7c0 100644
--- a/nixos/modules/services/networking/bird.nix
+++ b/nixos/modules/services/networking/bird.nix
@@ -44,6 +44,7 @@ let
         systemd.services.${variant} = {
           description = "BIRD Internet Routing Daemon (${descr})";
           wantedBy = [ "multi-user.target" ];
+          reloadIfChanged = true;
           serviceConfig = {
             Type = "forking";
             Restart = "on-failure";
diff --git a/nixos/modules/services/networking/dnscrypt-proxy.xml b/nixos/modules/services/networking/dnscrypt-proxy.xml
index ff1088698589..a97579202523 100644
--- a/nixos/modules/services/networking/dnscrypt-proxy.xml
+++ b/nixos/modules/services/networking/dnscrypt-proxy.xml
@@ -14,7 +14,7 @@
     upstream is trustworthy).
   </para>
 
-  <sect1><title>Basic configuration</title>
+  <sect1 xml:id="sec-dnscrypt-proxy-configuration"><title>Basic configuration</title>
 
   <para>
     To enable the client proxy, set
@@ -31,7 +31,7 @@
 
   </sect1>
 
-  <sect1><title>As a forwarder for another DNS client</title>
+  <sect1 xml:id="sec-dnscrypt-proxy-forwarder"><title>As a forwarder for another DNS client</title>
 
   <para>
     To run the DNSCrypt proxy client as a forwarder for another
@@ -42,7 +42,7 @@
     </programlisting>
   </para>
 
-  <sect2><title>dnsmasq</title>
+  <sect2 xml:id="sec-dnscrypt-proxy-forwarder-dsnmasq"><title>dnsmasq</title>
   <para>
     <programlisting>
 {
@@ -53,7 +53,7 @@
   </para>
   </sect2>
 
-  <sect2><title>unbound</title>
+  <sect2 xml:id="sec-dnscrypt-proxy-forwarder-unbound"><title>unbound</title>
   <para>
     <programlisting>
 {
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index b0bc1c83d6b7..d5af4648e8f9 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -289,7 +289,7 @@ in {
             source = mkOption {
               type = types.path;
               description = ''
-                A script.
+                Path to the hook script.
               '';
             };
 
@@ -297,12 +297,28 @@ in {
               type = types.enum (attrNames dispatcherTypesSubdirMap);
               default = "basic";
               description = ''
-                Dispatcher hook type. Only basic hooks are currently available.
+                Dispatcher hook type. Look up the hooks described at
+                <link xlink:href="https://developer.gnome.org/NetworkManager/stable/NetworkManager.html">https://developer.gnome.org/NetworkManager/stable/NetworkManager.html</link>
+                and choose the type depending on the output folder.
+                You should then filter the event type (e.g., "up"/"down") from within your script.
               '';
             };
           };
         });
         default = [];
+        example = literalExample ''
+        [ {
+              source = pkgs.writeText "upHook" '''
+
+                if [ "$2" != "up" ]; then
+                    logger "exit: event $2 != up"
+                fi
+
+                # coreutils and iproute are in PATH too
+                logger "Device $DEVICE_IFACE coming up"
+            ''';
+            type = "basic";
+        } ]'';
         description = ''
           A list of scripts which will be executed in response to  network  events.
         '';
@@ -418,6 +434,7 @@ in {
       ++ lib.imap1 (i: s: {
         inherit (s) source;
         target = "NetworkManager/dispatcher.d/${dispatcherTypesSubdirMap.${s.type}}03userscript${lib.fixedWidthNumber 4 i}";
+        mode = "0544";
       }) cfg.dispatcherScripts
       ++ optional (dynamicHostsEnabled)
            { target = "NetworkManager/dnsmasq.d/dyndns.conf";
@@ -475,6 +492,14 @@ in {
       };
     };
 
+    systemd.services."NetworkManager-dispatcher" = {
+      wantedBy = [ "network.target" ];
+      restartTriggers = [ configFile ];
+
+      # useful binaries for user-specified hooks
+      path = [ pkgs.iproute pkgs.utillinux pkgs.coreutils ];
+    };
+
     # Turn off NixOS' network management
     networking = {
       useDHCP = false;