From 2f5b053b9e337a3fedf2c99a1d1cc69f0dbf30e7 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Thu, 23 Apr 2026 09:49:51 +0200 Subject: [PATCH] switch-to-configuration-ng: Document ExecReload reload semantics Update the compare_units doc comment and add a release-notes entry covering the new reload-instead-of-restart behaviour. --- nixos/doc/manual/release-notes/rl-2605.section.md | 2 ++ pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2605.section.md b/nixos/doc/manual/release-notes/rl-2605.section.md index ed4559794686..a652c7a3657c 100644 --- a/nixos/doc/manual/release-notes/rl-2605.section.md +++ b/nixos/doc/manual/release-notes/rl-2605.section.md @@ -347,6 +347,8 @@ See . +- `switch-to-configuration` now reloads a service instead of restarting it when the only change to its unit is `ExecReload=`, and takes no action when `ExecReload=` is removed. Previously both cases triggered a restart. + - [`hardware.nvidia.branch`](#opt-hardware.nvidia.branch) was added to select the NVIDIA driver branch; setting [`hardware.nvidia.package`](#opt-hardware.nvidia.package) overrides this. - The NixOS NVIDIA module wiring has been updated to match the new `nvidia-x11` output layout. diff --git a/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs b/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs index 1085e75674ce..f084f27b9ae2 100644 --- a/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs +++ b/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs @@ -489,9 +489,10 @@ enum UnitComparison { // Compare the contents of two unit files and return whether the unit needs to be restarted or // reloaded. If the units differ, the service is restarted unless the only difference is -// `X-Reload-Triggers` in the `Unit` section. If this is the only modification, the unit is -// reloaded instead of restarted. If the only difference is `Options` in the `[Mount]` section, the -// unit is reloaded rather than restarted. +// `X-Reload-Triggers` in the `[Unit]` section, `Options` in the `[Mount]` section, or `ExecReload` +// in the `[Service]` section, in which case the unit is reloaded rather than restarted. Removing +// `ExecReload` is treated as a no-op since the running process is unaffected and the new unit can +// no longer be reloaded. fn compare_units(current_unit: &UnitInfo, new_unit: &UnitInfo) -> UnitComparison { let mut ret = UnitComparison::Equal;