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";
|
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
|
# server hostnames in its config file, then it will never do
|
||||||
# anything ever again ("couldn't resolve ..., giving up on
|
# anything ever again ("couldn't resolve ..., giving up on
|
||||||
# it"), so we silently lose time synchronisation.
|
# 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
|
fi
|
||||||
|
|
||||||
#if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
|
#if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
|
||||||
@ -92,7 +92,9 @@ in
|
|||||||
config = mkIf config.networking.useDHCP {
|
config = mkIf config.networking.useDHCP {
|
||||||
|
|
||||||
jobs.dhcpcd =
|
jobs.dhcpcd =
|
||||||
{ wantedBy = [ "multi-user.target" ];
|
{ description = "DHCP Client";
|
||||||
|
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.service" ];
|
after = [ "network-interfaces.service" ];
|
||||||
|
|
||||||
path = [ dhcpcd pkgs.nettools pkgs.openresolv ];
|
path = [ dhcpcd pkgs.nettools pkgs.openresolv ];
|
||||||
|
@ -68,7 +68,8 @@ in
|
|||||||
jobs.ntpd =
|
jobs.ntpd =
|
||||||
{ description = "NTP daemon";
|
{ description = "NTP daemon";
|
||||||
|
|
||||||
startOn = "ip-up";
|
wantedBy = [ "ip-up.target" ];
|
||||||
|
partOf = [ "ip-up.target" ];
|
||||||
|
|
||||||
path = [ ntp ];
|
path = [ ntp ];
|
||||||
|
|
||||||
|
@ -259,6 +259,7 @@ let
|
|||||||
|
|
||||||
#ln -s ../getty@tty1.service $out/multi-user.target.wants/
|
#ln -s ../getty@tty1.service $out/multi-user.target.wants/
|
||||||
ln -s ../remote-fs.target $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
|
in
|
||||||
|
@ -195,10 +195,12 @@ in
|
|||||||
|
|
||||||
security.setuidPrograms = [ "ping" "ping6" ];
|
security.setuidPrograms = [ "ping" "ping6" ];
|
||||||
|
|
||||||
jobs.networkInterfaces =
|
jobs."network-interfaces" =
|
||||||
{ name = "network-interfaces";
|
{ description = "Static Network Interfaces";
|
||||||
|
|
||||||
startOn = "stopped udevtrigger";
|
after = [ "systemd-udev-settle.service" ];
|
||||||
|
before = [ "network.target" ];
|
||||||
|
wantedBy = [ "network.target" ];
|
||||||
|
|
||||||
path = [ pkgs.iproute ];
|
path = [ pkgs.iproute ];
|
||||||
|
|
||||||
@ -266,9 +268,8 @@ in
|
|||||||
${pkgs.stdenv.shell} ${pkgs.writeText "local-net-cmds" cfg.localCommands}
|
${pkgs.stdenv.shell} ${pkgs.writeText "local-net-cmds" cfg.localCommands}
|
||||||
|
|
||||||
${optionalString (cfg.interfaces != [] || cfg.localCommands != "") ''
|
${optionalString (cfg.interfaces != [] || cfg.localCommands != "") ''
|
||||||
# Emit the ip-up event (e.g. to start ntpd).
|
# Start the ip-up target (e.g. to start ntpd).
|
||||||
#FIXME
|
${config.system.build.systemd}/bin/systemctl start ip-up.target
|
||||||
#initctl emit -n ip-up
|
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user