From 280715cf39ac9a8b8aec31bb99bd7950b39b5d91 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Wed, 1 Jan 2025 12:28:07 +0800 Subject: [PATCH] nixos/kmonad: make sure new config is used after nixos-rebuild switch --- nixos/modules/services/hardware/kmonad.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/modules/services/hardware/kmonad.nix b/nixos/modules/services/hardware/kmonad.nix index fc548d51603e..acbb202b19a1 100644 --- a/nixos/modules/services/hardware/kmonad.nix +++ b/nixos/modules/services/hardware/kmonad.nix @@ -155,6 +155,19 @@ let config.users.groups.uinput.name ] ++ keyboard.extraGroups; }; + # make sure the new config is used after nixos-rebuild switch + # stopIfChanged controls[0] how a service is "restarted" during + # nixos-rebuild switch. By default, stopIfChanged is true, which stops + # the old service and then starts the new service after config updates. + # Since we use path-based activation[1] here, the service unit will + # immediately[2] be started by the path unit. Probably that start is + # before config updates, whcih causes the service unit to use the old + # config after nixos-rebuild switch. Setting stopIfChanged to false works + # around this issue by restarting the service after config updates. + # [0]: https://nixos.org/manual/nixos/unstable/#sec-switching-systems + # [1]: man 7 daemon + # [2]: man 5 systemd.path + stopIfChanged = false; }; in {