mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/systemd: Temporarily bring back multi-user -> network-online
There were several modules, critically including NetworkManager, which were not prepared for this change. Most of the change was good, however. Let's bring back the dependency and change the assertion to a warning for now.
This commit is contained in:
parent
e041a4bbea
commit
0d85bf0efe
2 changed files with 35 additions and 39 deletions
|
@ -428,7 +428,13 @@ in
|
|||
|
||||
config = {
|
||||
|
||||
warnings = concatLists (
|
||||
warnings = let
|
||||
mkOneNetOnlineWarn = typeStr: name: def: lib.optional
|
||||
(lib.elem "network-online.target" def.after && !(lib.elem "network-online.target" (def.wants ++ def.requires ++ def.bindsTo)))
|
||||
"${name}.${typeStr} is ordered after 'network-online.target' but doesn't depend on it";
|
||||
mkNetOnlineWarns = typeStr: defs: lib.concatLists (lib.mapAttrsToList (mkOneNetOnlineWarn typeStr) defs);
|
||||
mkMountNetOnlineWarns = typeStr: defs: lib.concatLists (map (m: mkOneNetOnlineWarn typeStr m.what m) defs);
|
||||
in concatLists (
|
||||
mapAttrsToList
|
||||
(name: service:
|
||||
let
|
||||
|
@ -449,39 +455,30 @@ in
|
|||
]
|
||||
)
|
||||
cfg.services
|
||||
);
|
||||
)
|
||||
++ (mkNetOnlineWarns "target" cfg.targets)
|
||||
++ (mkNetOnlineWarns "service" cfg.services)
|
||||
++ (mkNetOnlineWarns "socket" cfg.sockets)
|
||||
++ (mkNetOnlineWarns "timer" cfg.timers)
|
||||
++ (mkNetOnlineWarns "path" cfg.paths)
|
||||
++ (mkMountNetOnlineWarns "mount" cfg.mounts)
|
||||
++ (mkMountNetOnlineWarns "automount" cfg.automounts)
|
||||
++ (mkNetOnlineWarns "slice" cfg.slices);
|
||||
|
||||
assertions = let
|
||||
mkOneAssert = typeStr: name: def: {
|
||||
assertion = lib.elem "network-online.target" def.after -> lib.elem "network-online.target" (def.wants ++ def.requires ++ def.bindsTo);
|
||||
message = "${name}.${typeStr} is ordered after 'network-online.target' but doesn't depend on it";
|
||||
};
|
||||
mkAsserts = typeStr: lib.mapAttrsToList (mkOneAssert typeStr);
|
||||
mkMountAsserts = typeStr: map (m: mkOneAssert typeStr m.what m);
|
||||
in mkMerge [
|
||||
(concatLists (
|
||||
mapAttrsToList
|
||||
(name: service:
|
||||
map (message: {
|
||||
assertion = false;
|
||||
inherit message;
|
||||
}) (concatLists [
|
||||
(optional ((builtins.elem "network-interfaces.target" service.after) || (builtins.elem "network-interfaces.target" service.wants))
|
||||
"Service '${name}.service' is using the deprecated target network-interfaces.target, which no longer exists. Using network.target is recommended instead."
|
||||
)
|
||||
])
|
||||
)
|
||||
cfg.services
|
||||
))
|
||||
(mkAsserts "target" cfg.targets)
|
||||
(mkAsserts "service" cfg.services)
|
||||
(mkAsserts "socket" cfg.sockets)
|
||||
(mkAsserts "timer" cfg.timers)
|
||||
(mkAsserts "path" cfg.paths)
|
||||
(mkMountAsserts "mount" cfg.mounts)
|
||||
(mkMountAsserts "automount" cfg.automounts)
|
||||
(mkAsserts "slice" cfg.slices)
|
||||
];
|
||||
assertions = concatLists (
|
||||
mapAttrsToList
|
||||
(name: service:
|
||||
map (message: {
|
||||
assertion = false;
|
||||
inherit message;
|
||||
}) (concatLists [
|
||||
(optional ((builtins.elem "network-interfaces.target" service.after) || (builtins.elem "network-interfaces.target" service.wants))
|
||||
"Service '${name}.service' is using the deprecated target network-interfaces.target, which no longer exists. Using network.target is recommended instead."
|
||||
)
|
||||
])
|
||||
)
|
||||
cfg.services
|
||||
);
|
||||
|
||||
system.build.units = cfg.units;
|
||||
|
||||
|
@ -658,6 +655,7 @@ in
|
|||
systemd.services.systemd-udev-settle.restartIfChanged = false; # Causes long delays in nixos-rebuild
|
||||
systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
|
||||
systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
|
||||
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
|
||||
systemd.services.systemd-importd.environment = proxy_env;
|
||||
systemd.services.systemd-pstore.wantedBy = [ "sysinit.target" ]; # see #81138
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue