fix conditions for enabling services

Without this fix, kresd and others would get enabled even though the
main mailserver option is disabled.
This commit is contained in:
Silvan Mosberger
2018-05-22 23:08:49 +02:00
parent 68232ddf87
commit 845e06e61a
7 changed files with 11 additions and 11 deletions
+4 -4
View File
@@ -22,17 +22,17 @@ let
cfg = config.mailserver;
in
{
config = mkIf cfg.rebootAfterKernelUpgrade.enable {
config = mkIf (cfg.enable && cfg.rebootAfterKernelUpgrade.enable) {
systemd.services.nixos-upgrade.serviceConfig.ExecStartPost = pkgs.writeScript "post-upgrade-check" ''
#!${pkgs.stdenv.shell}
# Checks whether the "current" kernel is different from the booted kernel
# and then triggers a reboot so that the "current" kernel will be the booted one.
# This is just an educated guess. If the links do not differ the kernels might still be different, according to spacefrogg in #nixos.
current=$(readlink -f /run/current-system/kernel)
booted=$(readlink -f /run/booted-system/kernel)
if [ "$current" == "$booted" ]; then
echo "kernel version seems unchanged, skipping reboot" | systemd-cat --priority 4 --identifier "post-upgrade-check";
else