Skip to content

Instantly share code, notes, and snippets.

@bubba-h57
Created July 19, 2022 14:14
Show Gist options
  • Save bubba-h57/2835ae4cac49341acc18ac9f5760b84c to your computer and use it in GitHub Desktop.
Save bubba-h57/2835ae4cac49341acc18ac9f5760b84c to your computer and use it in GitHub Desktop.
WSLg Configurations for Laravel PHP Development with PHPStorm and Tinkerwell
# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Specify a custom Linux kernel to use with your installed distros.
# The default kernel used can be found at https://github.com/microsoft/WSL2-Linux-Kernel
# kernel=
# Limits VM memory to use no more than 16 GB, this can be set as whole numbers using GB or MB
memory=16GB
# Sets the VM to use twelve virtual processors
processors=12
# Turn off default connection to bind WSL 2 localhost to Windows localhost
localhostforwarding=true
# Sets additional kernel parameters, in this case enabling older Linux base images such as Centos 6
kernelCommandLine=
# Sets amount of swap storage space to 4GB, default is 25% of available RAM
swap=4GB
# Sets swapfile path location
swapfile=%USERPROFILE%\AppData\Local\Temp\swap.vhdx
# Disable page reporting so WSL retains all allocated memory claimed from Windows and releases none back when free
pageReporting=false
# Boolean to turn on or off support for GUI applications (WSLg) in WSL. Only available for Windows 11.
guiApplications=true
# Boolean to turn on an output console Window that shows the contents of dmesg upon start of a WSL 2 distro instance. Only available for Windows 11.
debugConsole=false
# Boolean to turn on or off nested virtualization, enabling other nested VMs to run inside WSL 2. Only available for Windows 11.
nestedVirtualization=true
# The number of milliseconds that a VM is idle, before it is shut down. Only available for Windows 11.
vmIdleTimeout=60000
1. Configure `%USERPROFILE%\.wslconfig` it is a configuration file for all your WSL2 linux distros.
2. Configure `/etc/wsl.conf` on the target Distribution which is a WSL2 instance specific configuration.
3. Install phpstorm inside the WSL environment.
4. Configure `/usr/share/applications/jetbrains-phpstorm.desktop` to have it show up in the windows start menu.
5. Install Tinkerwell inside the WSL environment.
6. Configure `/usr/share/applications/tinkerwell.desktop` to have it show up in the windows start menu.
7. Turn it off and turn it back on again.
8. Profit.
[Desktop Entry]
Version=1.0
Type=Application
Name=PhpStorm
Icon=/opt/PhpStorm-221.5921.28/bin/phpstorm.png
Exec="/opt/PhpStorm-221.5921.28/bin/phpstorm.sh" %f
Comment=Lightning-smart PHP IDE
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-phpstorm
StartupNotify=true
[Desktop Entry]
Name=Tinkerwell
Exec=/usr/local/bin/tinkerwell
Terminal=false
Type=Application
Icon=tinkerwell
StartupWMClass=Tinkerwell
X-AppImage-Version=3.4.0
Comment=Tinker with your PHP applications
Categories=Utility;
# Automatically mount Windows drive when the distribution is launched
[automount]
# Set to true will automount fixed drives (C:/ or D:/) with DrvFs under the root directory set above. Set to false means drives won't be mounted automatically, but need to be mounted manually or with fstab.
enabled = true
# Sets the `/etc/fstab` file to be processed when a WSL distribution is launched.
mountFsTab = true
# Sets the directory where fixed drives will be automatically mounted. This example changes the mount location, so your C-drive would be /c, rather than the default /mnt/c.
root = /mnt/
# DrvFs-specific options can be specified.
options="metadata=disabled,uid=1000,gid=1000,umask=022,case=off"
# Network host settings that enable the DNS server used by WSL 2. This example changes the hostname, sets generateHosts to false, preventing WSL from the default behavior of auto-generating /etc/hosts, and sets generateResolvConf to false, preventing WSL from auto-generating /etc/resolv.conf, so that you can create your own (ie. nameserver 1.1.1.1).
[network]
# Sets hostname to be used for WSL distribution.
hostname=wsl-ubuntu
# true sets WSL to generate /etc/hosts. The hosts file contains a static map of hostnames corresponding IP address.
generateHosts=true
# true set WSL to generate /etc/resolv.conf. The resolv.conf contains a DNS list that are capable of resolving a given hostname to its IP address.
generateResolvConf=true
# Set whether WSL supports interop process like launching Windows apps and adding path variables. Setting these to false will block the launch of Windows processes and block adding $PATH environment variables.
[interop]
# Setting this key will determine whether WSL will support launching Windows processes.
enabled=true
# Setting this key will determine whether WSL will add Windows path elements to the $PATH environment variable.
appendWindowsPath=false
# Set the user when launching a distribution with WSL.
[user]
default = bubba
# Set a command to run when a new WSL instance launches. This example starts the dbus service.
[boot]
command = "service dbus start; mkdir -p /run/user/1000; chmod 700 /run/user/1000; chown bubba:bubba /run/user/1000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment