Skip to content

Commit

Permalink
Fix user units with systemd 256
Browse files Browse the repository at this point in the history
Starting with systemd 256, `user@%i` BindsTo `user-runtime-dir@%i`,
so we can't just have the latter be skipped and still get a user
service manager instance. So, replace it with a script that basically
does the exact same thing, but "succeeds" when the directory is there.
  • Loading branch information
K900 committed Jul 26, 2024
1 parent abfab7a commit b97e70e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/wsl-distro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,20 @@ in
# Prevent systemd from mounting a tmpfs over the runtime dir (and thus hiding the wayland socket)
systemd.services."user-runtime-dir@" = {
overrideStrategy = "asDropin";
unitConfig.ConditionPathExists = "!/run/user/%i";
serviceConfig.ExecStart =
let
wrapped = pkgs.writeShellScript "user-runtime-dir-start-wrapped" ''
if [ -d "/run/user/$1" ]; then
exit 0
else
${config.systemd.package}/lib/systemd/systemd-user-runtime-dir start "$1"
fi
'';
in
[
"" # unset old value
"${wrapped} %i"
];
};

# dhcp is handled by windows
Expand Down

0 comments on commit b97e70e

Please sign in to comment.