From f6d1cad6ba228b81bf7045f1124aa99dfdcf3daa Mon Sep 17 00:00:00 2001 From: Connor Prussin Date: Sat, 21 Aug 2021 19:14:40 -0700 Subject: [PATCH] [nixos] Fix race condition with user units (#2286) One of the things managed by the `home-manager-` unit is the systemd user directory `.config/systemd/user`. However, this directory needs to be in place completely before systemd user sessions start up or the user sessions will come up with an incomplete listing of enabled units, etc. There was a race condition where nothing prevented `systemd-user-sessions.service` from starting ahead of the systemd user directory's initialization completing. This commit makes `home-manager-` finishes _before_ we start `systemd-user-sessions.service` to avoid such race condition. This issue was probably not all that noticeable in most cases, but when using a non-persistent root config (i.e. tmp on / or https://grahamc.com/blog/erase-your-darlings) the race condition triggering causes all kinds of issues on each reboot. --- nixos/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/default.nix b/nixos/default.nix index f6301c0dc..e5c6cd2f6 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -129,6 +129,7 @@ in { wantedBy = [ "multi-user.target" ]; wants = [ "nix-daemon.socket" ]; after = [ "nix-daemon.socket" ]; + before = [ "systemd-user-sessions.service" ]; environment = serviceEnvironment;