diff --git a/modules/tasks/network-interfaces.nix b/modules/tasks/network-interfaces.nix index b9c5d897295..ef8e486ebcf 100644 --- a/modules/tasks/network-interfaces.nix +++ b/modules/tasks/network-interfaces.nix @@ -173,6 +173,16 @@ in ''; }; + 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 @@ in ''; }; + 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.