mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
Merge pull request #48771 from arianvp/container-tweaks
nixos/containers: Introduce several tweaks to systemd-nspawn from upstream systemd
This commit is contained in:
commit
553e0d81ee
@ -112,6 +112,7 @@ in {
|
|||||||
|
|
||||||
environment.etc."systemd/nspawn".source = generateUnits "nspawn" units [] [];
|
environment.etc."systemd/nspawn".source = generateUnits "nspawn" units [] [];
|
||||||
|
|
||||||
|
systemd.targets."multi-user".wants = [ "machines.target "];
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,9 @@ let
|
|||||||
|
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|
||||||
|
Slice = "machine.slice";
|
||||||
|
Delegate = true;
|
||||||
|
|
||||||
# Hack: we don't want to kill systemd-nspawn, since we call
|
# Hack: we don't want to kill systemd-nspawn, since we call
|
||||||
# "machinectl poweroff" in preStop to shut down the
|
# "machinectl poweroff" in preStop to shut down the
|
||||||
# container cleanly. But systemd requires sending a signal
|
# container cleanly. But systemd requires sending a signal
|
||||||
@ -657,6 +660,8 @@ in
|
|||||||
serviceConfig = serviceDirectives dummyConfig;
|
serviceConfig = serviceDirectives dummyConfig;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
systemd.targets."multi-user".wants = [ "machines.target" ];
|
||||||
|
|
||||||
systemd.services = listToAttrs (filter (x: x.value != null) (
|
systemd.services = listToAttrs (filter (x: x.value != null) (
|
||||||
# The generic container template used by imperative containers
|
# The generic container template used by imperative containers
|
||||||
[{ name = "container@"; value = unit; }]
|
[{ name = "container@"; value = unit; }]
|
||||||
@ -680,7 +685,7 @@ in
|
|||||||
} // (
|
} // (
|
||||||
if config.autoStart then
|
if config.autoStart then
|
||||||
{
|
{
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "machines.target" ];
|
||||||
wants = [ "network.target" ];
|
wants = [ "network.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
restartTriggers = [ config.path ];
|
restartTriggers = [ config.path ];
|
||||||
|
Loading…
Reference in New Issue
Block a user