From 1f41365cdacf9d101e4b2a54b7f74ad637ce3f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Tue, 7 Dec 2021 12:44:08 +0100 Subject: [PATCH] nixos/switch-to-configuration: Restart systemd when system.conf is changed --- nixos/modules/system/activation/switch-to-configuration.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index 9bf7a5c0d427..d3e9a97c2120 100644 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -351,8 +351,14 @@ foreach my $device (keys %$prevSwaps) { # Should we have systemd re-exec itself? my $prevSystemd = abs_path("/proc/1/exe") // "/unknown"; +my $prevSystemdSystemConfig = abs_path("/etc/systemd/system.conf") // "/unknown"; my $newSystemd = abs_path("@systemd@/lib/systemd/systemd") or die; +my $newSystemdSystemConfig = abs_path("$out/etc/systemd/system.conf") // "/unknown"; + my $restartSystemd = $prevSystemd ne $newSystemd; +if ($prevSystemdSystemConfig ne $newSystemdSystemConfig) { + $restartSystemd = 1; +} sub filterUnits {