summary refs log tree commit diff
path: root/nixos/modules/virtualisation/containers.nix
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-10-31 16:08:16 +0000
committerGitHub <noreply@github.com>2018-10-31 16:08:16 +0000
commit553e0d81ee263d35e761987c92b6fb8e289ca32f (patch)
treefa43ebb8fc095ed6e0f6f68345ce08a0f0ec322e /nixos/modules/virtualisation/containers.nix
parente4bfc708e5967d2050c08d3ade580b8bd0c0e4ce (diff)
parent9f72791516f0f4a3f9ef5a24259f7e4a06896ec5 (diff)
downloadnixpkgs-553e0d81ee263d35e761987c92b6fb8e289ca32f.tar
nixpkgs-553e0d81ee263d35e761987c92b6fb8e289ca32f.tar.gz
nixpkgs-553e0d81ee263d35e761987c92b6fb8e289ca32f.tar.bz2
nixpkgs-553e0d81ee263d35e761987c92b6fb8e289ca32f.tar.lz
nixpkgs-553e0d81ee263d35e761987c92b6fb8e289ca32f.tar.xz
nixpkgs-553e0d81ee263d35e761987c92b6fb8e289ca32f.tar.zst
nixpkgs-553e0d81ee263d35e761987c92b6fb8e289ca32f.zip
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.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index 572092a2ba9..2fcc0f25425 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 ];