1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-12 21:09:49 +01:00

[nixos] Fix race condition with user units (#2286) (#2287)

One of the things managed by the `home-manager-<username>` 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-<username>` 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.
This commit is contained in:
Connor Prussin 2021-08-21 20:51:31 -07:00 committed by GitHub
parent b39647e52e
commit 9f2b766d0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,6 +125,7 @@ in {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "nix-daemon.socket" ]; wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ]; after = [ "nix-daemon.socket" ];
before = [ "systemd-user-sessions.service" ];
environment = serviceEnvironment; environment = serviceEnvironment;