Author: mkwik
Date: Sun Mar  4 12:58:11 2012
New Revision: 32764
URL: https://nixos.org/websvn/nix/?rev=32764&sc=1

Log:
all-interfaces event

many services depend on other services that bring up network interfaces.
Examples are ipv6 tunneling clients or VPNs.

As there are multiple choices for these network-interface-providing services,
it's not nice to hardcore these deps in every service.
This change sets up a generic config option for this purpose.

providers (gw6c/gogoclient/openvpn) can plug into this to signal they bring up
an important interface.

Daemons that need these interfaces, can then depend on the 'all-interfaces' 
event,
instead of the individual services.

By default, the event fires when network-interfaces completes.

Modified:
   nixos/trunk/modules/tasks/network-interfaces.nix

Modified: nixos/trunk/modules/tasks/network-interfaces.nix
==============================================================================
--- nixos/trunk/modules/tasks/network-interfaces.nix    Sun Mar  4 12:58:09 
2012        (r32763)
+++ nixos/trunk/modules/tasks/network-interfaces.nix    Sun Mar  4 12:58:11 
2012        (r32764)
@@ -173,6 +173,16 @@
       '';
     };
 
+    networking.interfaceJobs = mkOption {
+      default = [config.jobs.networkInterfaces];
+      type = types.list types.attrs;
+      merge = mergeListOption;
+      description = ''
+        List of jobs that bring up additional interfaces.
+        For example vpn / ipv6 / ppp tasks.
+        This gets used by certain services as dependency for their upstart job.
+      '';
+    };
   };
 
 
@@ -273,6 +283,19 @@
           '';
       };
 
+    jobs.allInterfaces = {
+      name = "all-interfaces";
+      description = "all required interfaces are up";
+      startOn = concatStringsSep " and " (map (job: "started ${job.name}") 
cfg.interfaceJobs);
+      stopOn  = concatStringsSep " and " (map (job: "stopping ${job.name}") 
cfg.interfaceJobs);
+      task = true;
+      exec = "true";
+    };
+
+
+    networking.interfaceJobs = [config.jobs.networkInterfaces];
+    
+
     # Set the host name in the activation script.  Don't clear it if
     # it's not configured in the NixOS configuration, since it may
     # have been set by dhclient in the meantime.
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to