Skip to content

Commit ac02694

Browse files
authored
Merge pull request #521 from nix-community/systemd-256
Fix user units with systemd 256
2 parents 78ce208 + 10154ce commit ac02694

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

modules/wsl-distro.nix

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,20 @@ in
138138
# Prevent systemd from mounting a tmpfs over the runtime dir (and thus hiding the wayland socket)
139139
systemd.services."user-runtime-dir@" = {
140140
overrideStrategy = "asDropin";
141-
unitConfig.ConditionPathExists = "!/run/user/%i";
141+
serviceConfig.ExecStart =
142+
let
143+
wrapped = pkgs.writeShellScript "user-runtime-dir-start-wrapped" ''
144+
if [ -d "/run/user/$1" ]; then
145+
exit 0
146+
else
147+
${config.systemd.package}/lib/systemd/systemd-user-runtime-dir start "$1"
148+
fi
149+
'';
150+
in
151+
[
152+
"" # unset old value
153+
"${wrapped} %i"
154+
];
142155
};
143156

144157
# dhcp is handled by windows

0 commit comments

Comments
 (0)