Disable various services when running inside a container

This commit is contained in:
Eelco Dolstra
2013-11-26 18:19:45 +01:00
parent da093461a2
commit 2b1f212494
11 changed files with 35 additions and 14 deletions
+12 -12
View File
@@ -6,20 +6,20 @@ with pkgs.lib;
# This unit saves the value of the system clock to the hardware
# clock on shutdown.
systemd.units."save-hwclock.service" =
{ wantedBy = [ "shutdown.target" ];
systemd.services.save-hwclock =
{ description = "Save Hardware Clock";
text =
''
[Unit]
Description=Save Hardware Clock
DefaultDependencies=no
Before=shutdown.target
wantedBy = [ "shutdown.target" ];
[Service]
Type=oneshot
ExecStart=${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}
'';
unitConfig = {
DefaultDependencies = false;
ConditionVirtualization = "!systemd-nspawn";
};
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}";
};
};
boot.kernel.sysctl."kernel.poweroff_cmd" = "${config.systemd.package}/sbin/poweroff";