mirror of
https://github.com/sstent/vmimages.git
synced 2026-01-25 14:41:44 +00:00
58 lines
1.5 KiB
Nix
58 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
inputs,
|
|
outputs,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib; let
|
|
cfg = config.custom.wsl;
|
|
in {
|
|
options.custom.wsl.enable = mkEnableOption "Enable WSL2 settings";
|
|
|
|
config = mkIf cfg.enable {
|
|
# Enable native Docker support
|
|
virtualisation.docker.enable = true;
|
|
|
|
wsl = {
|
|
enable = true;
|
|
wslConf.automount.root = "/mnt";
|
|
defaultUser = "sstent";
|
|
startMenuLaunchers = true;
|
|
wslConf.interop.appendWindowsPath = false;
|
|
#No longer needed in 23.05
|
|
#interop.preserveArgvZero = true;
|
|
# docker-native.enable = true;
|
|
|
|
nativeSystemd = true;
|
|
# Enable integration with Docker Desktop (needs to be installed)
|
|
# docker-desktop.enable = true;
|
|
};
|
|
|
|
systemd.services.nixs-wsl-systemd-fix = {
|
|
description = "Fix the /dev/shm symlink to be a mount";
|
|
unitConfig = {
|
|
DefaultDependencies = "no";
|
|
Before = [
|
|
"sysinit.target"
|
|
"systemd-tmpfiles-setup-dev.service"
|
|
"systemd-tmpfiles-setup.service"
|
|
"systemd-sysctl.service"
|
|
];
|
|
ConditionPathExists = "/dev/shm";
|
|
ConditionPathIsSymbolicLink = "/dev/shm";
|
|
ConditionPathIsMountPoint = "/run/shm";
|
|
};
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = [
|
|
"${pkgs.coreutils-full}/bin/rm /dev/shm"
|
|
"/run/wrappers/bin/mount --bind -o X-mount.mkdir /run/shm /dev/shm"
|
|
];
|
|
};
|
|
wantedBy = ["sysinit.target"];
|
|
};
|
|
};
|
|
}
|