diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2018-10-31 16:08:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-31 16:08:16 +0000 |
commit | 553e0d81ee263d35e761987c92b6fb8e289ca32f (patch) | |
tree | fa43ebb8fc095ed6e0f6f68345ce08a0f0ec322e /nixos/modules/virtualisation/containers.nix | |
parent | e4bfc708e5967d2050c08d3ade580b8bd0c0e4ce (diff) | |
parent | 9f72791516f0f4a3f9ef5a24259f7e4a06896ec5 (diff) |
Merge pull request #48771 from arianvp/container-tweaks
nixos/containers: Introduce several tweaks to systemd-nspawn from upstream systemd
Diffstat (limited to 'nixos/modules/virtualisation/containers.nix')
-rw-r--r-- | nixos/modules/virtualisation/containers.nix | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix index 572092a2ba94..2fcc0f254256 100644 --- a/nixos/modules/virtualisation/containers.nix +++ b/nixos/modules/virtualisation/containers.nix @@ -243,6 +243,9 @@ let Restart = "on-failure"; + Slice = "machine.slice"; + Delegate = true; + # Hack: we don't want to kill systemd-nspawn, since we call # "machinectl poweroff" in preStop to shut down the # container cleanly. But systemd requires sending a signal @@ -657,6 +660,8 @@ in serviceConfig = serviceDirectives dummyConfig; }; in { + systemd.targets."multi-user".wants = [ "machines.target" ]; + systemd.services = listToAttrs (filter (x: x.value != null) ( # The generic container template used by imperative containers [{ name = "container@"; value = unit; }] @@ -680,7 +685,7 @@ in } // ( if config.autoStart then { - wantedBy = [ "multi-user.target" ]; + wantedBy = [ "machines.target" ]; wants = [ "network.target" ]; after = [ "network.target" ]; restartTriggers = [ config.path ]; |