Bot releases are hidden (Show)
This release mainly brings support for NixOS 23.11. Besides that, NixOS-WSL now includes a module to enable support for passing through USB devices via usbip
If you haven't done that already, perform the steps detailed in the 23.05.5 release to migrate to nix-channels. Then do the following:
sudo nix-channel --add https://nixos.org/channels/nixos-23.11 nixos
sudo nix-channel --update
sudo nixos-rebuild switch
If you're using flakes instead of channels, update your nixpkgs
input to 23.11
, run nix flake update
and rebuild your system.
Published by nzbr about 1 year ago
With recent WSL releases, Microsoft added native support for running systemd inside WSL without container trickery. This release deprecates the old method container-based startup process (syschdemd) and uses WSL's native systemd support as the default. "Legacy" tarballs that use the old container trick are still available for now, but will likely go away with the next release.
The wsl.docker-native
and wsl.interop.preserveArgvZero
options have been removed, as the workarounds they applied are no longer necessary. To run Docker inside of NixOS-WSL, simply enable virtualisation.docker.enable
, like you would on any other NixOS system.
The release tarballs built by NixOS-WSL no longer use a two-stage install process - you simply get a complete rootfs snapshot you can wsl --import
directly. The tarball is also now built using conventional tools like nixos-install
, to ensure the system ends up in a consistent state. This should not affect users in general, but users that want to build customized tarballs are encouraged to check the updated README.md.
This release and all future releases will only support the Microsoft Store version of WSL.
To see if you have it installed, run wsl --version
in PowerShell. If it does not report a version number, but complains about --version
not being a recognized option, you are still running the "inbox" version of WSL that was shipped with Windows, and should upgrade to the Store version.
To make future updates less of a manual process, we are transitioning to distributing the WSL specific modules through a nix-channel. This will make sure, that you get the latest updates and bugfixes every time you run nix-channel --update
. (If you are using flakes: You can keep on doing that. This doesn't affect you)
The WSL 2.0 update introduced some changes to how the filesystem is set up, making NixOS-WSL's container tricks no longer work. If you encounter unshare: ...: invalid argument
when starting NixOS-WSL, please follow the recovery steps detailed here before upgrading.
Should you encounter any problems, please open an issue. If you have any questions, feel free to start a discussion or join our chat
sudo rm -rf /etc/nixos/nixos-wsl
sudo nix-channel --add https://github.com/nix-community/NixOS-WSL/archive/refs/heads/main.tar.gz nixos-wsl
sudo nix-channel --add https://nixos.org/channels/nixos-23.05 nixos
sudo nix-channel --update
configuration.nix
/etc/nixos/configuration.nix
(for example sudo nano /etc/nixos/configuration.nix
)
let ... in
block at the start of the file${modulesPath}/profiles/minimal.nix
nixos-wsl.nixosModules.wsl
to <nixos-wsl/modules>
nix.package = pkgs.nixFlakes;
(you will still be able to use flakes, the alias is no longer necessary)system.stateVersion
. Leave it on the version you first installed the system on{ lib, pkgs, config, modulesPath, ... }:
with lib;
{
imports = [
<nixos-wsl/modules>
];
wsl = {
enable = true;
automountPath = "/mnt";
defaultUser = "nixos";
startMenuLaunchers = true;
# Enable integration with Docker Desktop (needs to be installed)
# docker-desktop.enable = true;
};
# Enable nix flakes
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
system.stateVersion = "22.05";
}
sudo nixos-rebuild switch
wsl -t NixOS
wsl -d NixOS
Update your flake inputs and make sure, that your NixOS version is at least set to 23.05
.
If you import NixOS-WSL from a local directory, instead of as a flake input, you should add it to your flake's inputs instead, e.g.:
nixos-wsl.url = "github:nix-community/nixos-wsl";
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
and import it as
inputs.nixos-wsl.nixosModules.wsl
nixos-wsl-version
command (#183) @nzbrwsl.conf
(#153) @nzbrPublished by nzbr about 2 years ago
There is an issue where NixOS will hang on Starting systemd...
after the installation. Should you encounter it, please use nixos-wsl-x86_64-linux.tar.gz
instead of nixos-wsl-installer.tar.gz
.
Yes, I know; NixOS 22.05 has been out for a while and we're a little late to the party. As you can see from the changelog below, there were quite a few bugs we had to get rid of before publishing a release
binfmt_misc
registration is now turned off by default to prevent its unintended side effects. If you need it, just set wsl.interop.register = true
. nixos-rebuld should also issue a warning if you try to use boot.binfmt
without having it enabled
Both using docker-desktop and running docker as a service within NixOS are now supported and can be enabled with wsl.docker-desktop.enable = true
and wsl.docker-native.enable = true
respectively
Should you encounter any problems, please open an issue. If you have any questions, feel free to start a discussion or join our chat
If you used the method described in Xe Iaso's blogpost, please refer to the "Installer" method
Otherwise, just update your flake inputs and make sure to set the nixpkgs url to github:NixOS/nixpkgs/nixos-22.05
.
Replace the content of /etc/nixos/nixos-wsl
with the content of the source-tarball attached to this release, then run the following commands in order:
sudo nix-channel --add https://nixos.org/channels/nixos-22.05 nixos
sudo nix-channel --update
sudo nixos-rebuild switch
To switch over to the new update method, do the following:
Put the contents of the attached source-tarball into /etc/nixos/nixos-wsl
. If the directory already exists, that probably means that you are already using the newer method.
Change the (import (builtins.fetchGit ... )).nixosModules.wsl
line to (import ./nixos-wsl).nixosModules.wsl
Run nixos-rebuild switch
Published by nzbr over 2 years ago
nixos-wsl-installer-fixed.tar.gz
attached to this release instead of the regular oneThis is the promised 21.11 release
It includes a change that allows for running code from foreign architectures by registering them through binfmt_misc, just like on native NixOS. This feature is enabled by default, but it may lead to WSLInterop (being able to run windows executables) breaking in other WSL distributions as a side effect. Should you experience issues with this, you can disable it by setting wsl.interop.register = false
and removing all other binfmt registrations (if you have configured any). For more information on the underlying issue, see #64 and Microsoft/WSL#8203
Should you encounter any problems, feel free to start a discussion or open an issue!
Switch your nixpkgs url to github:NixOS/nixpkgs/nixos-21.11
and run nix flake update
Replace the content of /etc/nixos/nixos-wsl
with the content of the source-tarball attached to this release
Assuming that you followed the update procedure in the last release, replace refs/tags/20.09-1c1f5649
with refs/tags/21.11-d89f18a1
Published by nzbr over 2 years ago
This release addresses a lot of the problems, that people encountered since the previous one. To get it out as fast as possible, it is still based on NixOS 20.09. Expect a 21.11 release in the near future.
If you are importing this as a fresh distro, please make sure to use nixos-wsl-installer.tar.gz
instead of the other tarball, as importing it would fail with an "Unspecified Error".
If you already have an installation and want to update it, remove the WSL-Specific parts from your configuration and instead add the following:
imports = [ # If you already have imports you'll have to combine the two arrays
(import (builtins.fetchGit { url = "https://github.com/nix-community/NixOS-WSL.git"; ref = "refs/tags/20.09-1c1f5649"; })).nixosModules.wsl
];
wsl = {
enable = true;
automountPath = "/mnt";
defaultUser = "nixos"; # Replace this with your username
startMenuLaunchers = true;
};
If you are using flakes, add this repo as an input to your flake and replace the import in the above code snippet with
inputs.nixos-wsl.nixosModules.wsl
After that run nixos-rebuild switch
and you should be up and running.
Should you encounter any problems, feel free to open an issue in this repo!