Skip to content

Commit

Permalink
use mount unit instead
Browse files Browse the repository at this point in the history
  • Loading branch information
nzbr committed Feb 29, 2024
1 parent a6af1c0 commit 4954867
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions modules/wsl-distro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,26 @@ in
};

# Make sure the WSLg X11 socket is available if /tmp is mounted to something else
fileSystems."/tmp/.X11-unix/X0" = {
device = "${cfg.wslConf.automount.root}/wslg/.X11-unix/X0";
systemd.mounts = [rec {
description = "Mount WSLg X11 socket";
what = "${cfg.wslConf.automount.root}/wslg/.X11-unix/X0";
where = "/tmp/.X11-unix/X0";
type = "none";
options = [ "bind" ];
};
wantedBy = [ "local-fs.target" ];
after = [ "nixos-wsl-migration-x11mount.service" ];
wants = after;
}];
# Remove symbolic link for WSLg X11 socket, which was created by NixOS-WSL until 2024-02-24
systemd.services.nixos-wsl-migration-x11mount = {
description = "Remove /tmp/.X11-unix symlink if present";
before = [ "tmp-.X11\x2dunix-X0.mount" ];
unitConfig.ConditionPathIsSymbolicLink = "/tmp/.X11-unix";
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
serviceConfig.ExecStart = "${pkgs.coreutils}/bin/rm /tmp/.X11-unix";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.coreutils}/bin/rm /tmp/.X11-unix";
};
};

# dhcp is handled by windows
Expand Down

0 comments on commit 4954867

Please sign in to comment.