From 8cfd395bd5cb002f4beebd0ed6466067e7a1d7ce Mon Sep 17 00:00:00 2001 From: Philipp Heuer Date: Thu, 21 Dec 2023 12:50:48 +0100 Subject: [PATCH 1/2] feat: add option to toggle wslg x11 mount --- modules/systemd/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/systemd/default.nix b/modules/systemd/default.nix index 9199bcbf..d8f6f756 100644 --- a/modules/systemd/default.nix +++ b/modules/systemd/default.nix @@ -12,6 +12,11 @@ with lib; { default = true; description = "Use native WSL systemd support"; }; + wslgMountX11 = mkOption { + type = bool; + default = true; + description = "Mount the WSLg .X11-unix directory into /tmp"; + }; }; config = @@ -40,7 +45,7 @@ with lib; { # Link the X11 socket into place. This is a no-op on a normal setup, # but helps if /tmp is a tmpfs or mounted from some other location. - tmpfiles.rules = [ "L /tmp/.X11-unix - - - - ${cfg.wslConf.automount.root}/wslg/.X11-unix" ]; + tmpfiles.rules = mkIf cfg.wslgMountX11 ([ "L /tmp/.X11-unix - - - - ${cfg.wslConf.automount.root}/wslg/.X11-unix" ]); }; }; From 70ea09e281951dbe1f89a35dd91702c52ba28f88 Mon Sep 17 00:00:00 2001 From: Philipp Heuer Date: Sat, 23 Dec 2023 03:58:32 +0100 Subject: [PATCH 2/2] feat: remove option, use new tmpfiles syntax --- modules/systemd/default.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/systemd/default.nix b/modules/systemd/default.nix index d8f6f756..1d70a7bf 100644 --- a/modules/systemd/default.nix +++ b/modules/systemd/default.nix @@ -12,11 +12,6 @@ with lib; { default = true; description = "Use native WSL systemd support"; }; - wslgMountX11 = mkOption { - type = bool; - default = true; - description = "Mount the WSLg .X11-unix directory into /tmp"; - }; }; config = @@ -45,9 +40,15 @@ with lib; { # Link the X11 socket into place. This is a no-op on a normal setup, # but helps if /tmp is a tmpfs or mounted from some other location. - tmpfiles.rules = mkIf cfg.wslgMountX11 ([ "L /tmp/.X11-unix - - - - ${cfg.wslConf.automount.root}/wslg/.X11-unix" ]); + tmpfiles.settings = { + "10-wslg-x11" = { + "/tmp/.X11-unix" = { + L = { + argument = "${cfg.wslConf.automount.root}/wslg/.X11-unix"; + }; + }; + }; + }; }; - }; - }