-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsl.nix
39 lines (36 loc) · 1.31 KB
/
wsl.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ pkgs, ... }:
{
# https://github.com/nix-community/home-manager/blob/release-24.05/modules/systemd.nix#L161-L173
# Originally "system" should be better than "user", but it is not a home-manager role
systemd.user = {
# - This name should be same of Mount.Where. Do not use `-` except path separator
# - You can manually enable with `sudo systemctl enable ~/.config/systemd/user/mnt-wsl-instances-ubuntu24.mount --now`
mounts.mnt-wsl-instances-ubuntu24 =
# https://superuser.com/questions/1659218/is-there-a-way-to-access-files-from-one-wsl-2-distro-image-in-another-one
{
Unit = {
Description = "Apply path that can be accessed from another WSL instance";
};
Mount = {
What = "/";
Where = "/mnt/wsl/instances/ubuntu24";
Type = "none";
Options = "defaults,bind,X-mount.mkdir";
};
Install = {
WantedBy = [ "multi-user.target" ];
};
};
# - Set same name of Mount definition
# - You can manually enable with `systemctl enable --now mount-point.automount`
automounts.mnt-wsl-instances-ubuntu24 = {
Mount = {
Where = "/mnt/wsl/instances/ubuntu24";
};
Install = {
WantedBy = [ "multi-user.target" ];
};
};
};
home.packages = [ pkgs.wslu ];
}