From 65700b435c8a495e5ff7071e41db34bf49b9ef89 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 May 2015 15:48:45 +0200 Subject: [PATCH] Use ConditionVirtualization to disable some services in containers (cherry picked from commit c52a98380673093037a3116025d0aa92cd46a214) --- nixos/modules/system/boot/systemd.nix | 4 ++++ nixos/modules/virtualisation/container-config.nix | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 2ad12c51b21..d001feb063b 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -749,6 +749,10 @@ in systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true; systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true; + # Don't bother with certain units in containers. + systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container"; + systemd.services.systemd-random-seed.unitConfig.ConditionVirtualization = "!container"; + }; } diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix index 67047541102..c210c8d5f25 100644 --- a/nixos/modules/virtualisation/container-config.nix +++ b/nixos/modules/virtualisation/container-config.nix @@ -19,10 +19,6 @@ with lib; # Shut up warnings about not having a boot loader. system.build.installBootLoader = "${pkgs.coreutils}/bin/true"; - systemd.services.systemd-remount-fs.enable = false; - - systemd.services.systemd-random-seed.enable = false; - }; }