diff --git a/modules/config/networking.nix b/modules/config/networking.nix index 5896e9ec9fd..921972093ce 100644 --- a/modules/config/networking.nix +++ b/modules/config/networking.nix @@ -75,4 +75,10 @@ in target = "resolvconf.conf"; } ]; + + boot.systemd.units."ip-up.target".text = + '' + [Unit] + Description=Services Requiring IP Connectivity + ''; } diff --git a/modules/services/networking/dhcpcd.nix b/modules/services/networking/dhcpcd.nix index 77d4ac6253c..2767af7200e 100644 --- a/modules/services/networking/dhcpcd.nix +++ b/modules/services/networking/dhcpcd.nix @@ -56,9 +56,9 @@ let # server hostnames in its config file, then it will never do # anything ever again ("couldn't resolve ..., giving up on # it"), so we silently lose time synchronisation. - ${config.system.build.systemd}/bin/systemctl restart ntpd.service + ${config.system.build.systemd}/bin/systemctl try-restart ntpd.service - #${config.system.build.upstart}/sbin/initctl emit -n ip-up $params + ${config.system.build.systemd}/bin/systemctl start ip-up.target fi #if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then @@ -92,7 +92,9 @@ in config = mkIf config.networking.useDHCP { jobs.dhcpcd = - { wantedBy = [ "multi-user.target" ]; + { description = "DHCP Client"; + + wantedBy = [ "multi-user.target" ]; after = [ "network-interfaces.service" ]; path = [ dhcpcd pkgs.nettools pkgs.openresolv ]; diff --git a/modules/services/networking/ntpd.nix b/modules/services/networking/ntpd.nix index 7d1db8df066..e9b27268aa1 100644 --- a/modules/services/networking/ntpd.nix +++ b/modules/services/networking/ntpd.nix @@ -68,7 +68,8 @@ in jobs.ntpd = { description = "NTP daemon"; - startOn = "ip-up"; + wantedBy = [ "ip-up.target" ]; + partOf = [ "ip-up.target" ]; path = [ ntp ]; diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index 06019fa2a08..992981f0a36 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -259,6 +259,7 @@ let #ln -s ../getty@tty1.service $out/multi-user.target.wants/ ln -s ../remote-fs.target $out/multi-user.target.wants/ + ln -s ../network.target $out/multi-user.target.wants/ ''; # */ in diff --git a/modules/tasks/network-interfaces.nix b/modules/tasks/network-interfaces.nix index 5ff1a83bc81..5302fa82bd4 100644 --- a/modules/tasks/network-interfaces.nix +++ b/modules/tasks/network-interfaces.nix @@ -195,10 +195,12 @@ in security.setuidPrograms = [ "ping" "ping6" ]; - jobs.networkInterfaces = - { name = "network-interfaces"; + jobs."network-interfaces" = + { description = "Static Network Interfaces"; - startOn = "stopped udevtrigger"; + after = [ "systemd-udev-settle.service" ]; + before = [ "network.target" ]; + wantedBy = [ "network.target" ]; path = [ pkgs.iproute ]; @@ -266,9 +268,8 @@ in ${pkgs.stdenv.shell} ${pkgs.writeText "local-net-cmds" cfg.localCommands} ${optionalString (cfg.interfaces != [] || cfg.localCommands != "") '' - # Emit the ip-up event (e.g. to start ntpd). - #FIXME - #initctl emit -n ip-up + # Start the ip-up target (e.g. to start ntpd). + ${config.system.build.systemd}/bin/systemctl start ip-up.target ''} ''; };