Skip to content

Commit 0b29fc7

Browse files
authored
docker-desktop: fix bind mounts (#117)
1 parent b199d85 commit 0b29fc7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

modules/wsl-distro.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ with builtins; with lib;
3333
config =
3434
let
3535
cfg = config.wsl;
36-
syschdemd = import ../syschdemd.nix { inherit lib pkgs config; defaultUser = cfg.defaultUser; defaultUserHome = config.users.users.${cfg.defaultUser}.home; };
36+
syschdemd = import ../syschdemd.nix { inherit lib pkgs config; inherit (cfg) automountPath defaultUser; defaultUserHome = config.users.users.${cfg.defaultUser}.home; };
3737
in
3838
mkIf cfg.enable {
3939

syschdemd.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{ lib
22
, pkgs
33
, config
4+
, automountPath
45
, defaultUser
56
, defaultUserHome ? "/home/${defaultUser}"
67
, ...
@@ -21,6 +22,7 @@ pkgs.substituteAll {
2122

2223
systemdWrapper = pkgs.writeShellScript "systemd-wrapper.sh" ''
2324
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc || true
25+
mount --make-rshared ${automountPath}
2426
exec systemd
2527
'';
2628
}

syschdemd.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ systemPath=$(${sw}/readlink -f /nix/var/nix/profiles/system)
88
function start_systemd {
99
echo "Starting systemd..." >&2
1010

11-
@wrapperDir@/umount /proc/sys/fs/binfmt_misc || true
12-
1311
PATH=/run/current-system/systemd/lib/systemd:@fsPackagesPath@ \
1412
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive \
1513
@daemonize@/bin/daemonize /run/current-system/sw/bin/unshare -fp --mount-proc @systemdWrapper@
1614

1715
# Wait until systemd has been started to prevent a race condition from occuring
18-
while ! /run/current-system/sw/bin/pgrep -xf systemd >/run/systemd.pid; do
16+
while ! $sw/pgrep -xf systemd | $sw/tail -n1 >/run/systemd.pid; do
1917
$sw/sleep 1s
2018
done
2119

0 commit comments

Comments
 (0)