diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-26 18:17:12 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-26 18:19:45 +0100 |
commit | 2b1f21249445991940c9d3ebbc54ce41b1eaf9c0 (patch) | |
tree | 3c7f98ee825b69af81ba7215b6ef2489375e37b3 /nixos/modules/system/boot/shutdown.nix | |
parent | da093461a2ff09d6ea1071ff886866a1f85480c2 (diff) | |
download | nixlib-2b1f21249445991940c9d3ebbc54ce41b1eaf9c0.tar nixlib-2b1f21249445991940c9d3ebbc54ce41b1eaf9c0.tar.gz nixlib-2b1f21249445991940c9d3ebbc54ce41b1eaf9c0.tar.bz2 nixlib-2b1f21249445991940c9d3ebbc54ce41b1eaf9c0.tar.lz nixlib-2b1f21249445991940c9d3ebbc54ce41b1eaf9c0.tar.xz nixlib-2b1f21249445991940c9d3ebbc54ce41b1eaf9c0.tar.zst nixlib-2b1f21249445991940c9d3ebbc54ce41b1eaf9c0.zip |
Disable various services when running inside a container
Diffstat (limited to 'nixos/modules/system/boot/shutdown.nix')
-rw-r--r-- | nixos/modules/system/boot/shutdown.nix | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/nixos/modules/system/boot/shutdown.nix b/nixos/modules/system/boot/shutdown.nix index ad71a2e816e3..44cadcd64a76 100644 --- a/nixos/modules/system/boot/shutdown.nix +++ b/nixos/modules/system/boot/shutdown.nix @@ -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" ]; - - text = - '' - [Unit] - Description=Save Hardware Clock - DefaultDependencies=no - Before=shutdown.target - - [Service] - Type=oneshot - ExecStart=${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"} - ''; + systemd.services.save-hwclock = + { description = "Save Hardware Clock"; + + wantedBy = [ "shutdown.target" ]; + + 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"; |