Add an ip-up target for services that require IP connectivity
This commit is contained in:
parent
981347429a
commit
d18c2afc6f
|
@ -75,4 +75,10 @@ in
|
|||
target = "resolvconf.conf";
|
||||
}
|
||||
];
|
||||
|
||||
boot.systemd.units."ip-up.target".text =
|
||||
''
|
||||
[Unit]
|
||||
Description=Services Requiring IP Connectivity
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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 ];
|
||||
|
|
|
@ -68,7 +68,8 @@ in
|
|||
jobs.ntpd =
|
||||
{ description = "NTP daemon";
|
||||
|
||||
startOn = "ip-up";
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
partOf = [ "ip-up.target" ];
|
||||
|
||||
path = [ ntp ];
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
''}
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue