Skip to content

Releases: nix-community/NixOS-WSL

[2405.5.4] Upset Uakari

07 Jul 23:08
05098ab
Compare
Choose a tag to compare

Patch Notes

Besides NixOS 24.05, this release brings support for using Nvidia GPUs through the WSL2 integration of their Windows driver.

It will also be the first release to come with Launcher binaries attached. If you want to give that a try, download NixOS-WSL-Launcher.zip and extract it. Running .\NixOS.exe --help will list the things it is capable of so far. Please report any bugs you encounter. The launcher will be used for distributing NixOS-WSL through additional channels like scoop and eventually the Microsoft Store in the future.

syschdemd (the previous method for running systemd in WSL before Microsoft supported that directly) has been deprecated and is scheduled to be removed completely with the 24.11 release. If you have explicitly disabled native systemd in your config, please consider enabling it now.

Updating

Channels

  1. Switch your nixpkgs channel to 24.05
    • sudo nix-channel --add https://nixos.org/channels/nixos-24.05 nixos
  2. Update your channels
    • sudo nix-channel --update
  3. Rebuild your system
    • sudo nixos-rebuild switch

Flakes

If you're using flakes instead of channels, update your nixpkgs input to 24.05, run nix flake update and rebuild your system.

Changelog

🛠️ General Changes

🚀 Features

🪲 Bugfixes

  • fix: make wrapper not crash if logger setup fails (#496) @nzbr
  • fix(shell-wrapper): login shell and user systemd (#464) @nzbr
  • utils/shell-wrapper: hardcode paths to the right sh/env executables (#459) @K900
  • fix: Don't mask resolved systemd unit (#455) @SuperSandro2000
  • fix: prevent systemd from hiding wayland socket (#450) @nzbr
  • fix: /tmp/.X11-unix (#432) @nzbr
  • fix: bind mount X11 socket instead of symlinking (#420) @nzbr
  • fix: set state version when building tarballs (#419) @nzbr
  • fix: Create directory for symlink tree (#392) @SuperSandro2000
  • fix: Hard-code file names when making symbolic links for drivers (#383) @Atry
  • fix: start menu launchers rsync of directory symlinks (#380) @terlar
  • fix: symlink creation of per-user apps/icons folder (#368) @mprasil

🧪 Tests

📖 Documentation

[2311.5.3] Timely Tapir

17 Dec 15:29
34eda45
Compare
Choose a tag to compare

Patch Notes

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

Updating

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:

Channels

  1. Switch your nixpkgs channel to 23.11
    • sudo nix-channel --add https://nixos.org/channels/nixos-23.11 nixos
  2. Update your channels
    • sudo nix-channel --update
  3. Rebuild your system
    • sudo nixos-rebuild switch

Flakes

If you're using flakes instead of channels, update your nixpkgs input to 23.11, run nix flake update and rebuild your system.

Changelog

🛠️ General Changes

🚀 Features

🪲 Bugfixes

📖 Documentation

  • fix: get matrix chat info from matrix.org (#326) @nzbr

[23.5.5.2] Hotfix release

30 Sep 06:21
cadde47
Compare
Choose a tag to compare

Fixes the generated config in legacy tarballs to also disable native systemd support by default.

Note that legacy tarballs are still not recommended for most users.

Make sure to also read the release notes for 23.05.5.

[23.05.5] Sleepy Stoat

29 Sep 22:21
8735bdf
Compare
Choose a tag to compare

Patch Notes

Native systemd support by default

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.

Removing old workarounds

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.

New tarball build process

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.

Deprecating support for inbox versions of WSL

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.

Distributing NixOS-WSL via channels instead of a local checkout

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)

Recovering from "unshare: invalid argument"

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

Migrating from 22.05 releases

  1. Remove the old version of NixOS-WSL modules
    • sudo rm -rf /etc/nixos/nixos-wsl
  2. Add the new version of NixOS-WSL as a channel
    • sudo nix-channel --add https://github.com/nix-community/NixOS-WSL/archive/refs/heads/main.tar.gz nixos-wsl
  3. Update NixOS to 23.05
    • sudo nix-channel --add https://nixos.org/channels/nixos-23.05 nixos
  4. Update your channels
    • sudo nix-channel --update
  5. Adjust configuration.nix
    • Use the editor of your choice to edit /etc/nixos/configuration.nix (for example sudo nano /etc/nixos/configuration.nix)
      • Remove the let ... in block at the start of the file
      • Remove the import from ${modulesPath}/profiles/minimal.nix
      • Change the import from nixos-wsl.nixosModules.wsl to <nixos-wsl/modules>
      • Remove nix.package = pkgs.nixFlakes; (you will still be able to use flakes, the alias is no longer necessary)
      • Do not touch system.stateVersion. Leave it on the version you first installed the system on
    • Save the file ([Ctrl]-[O], [Enter], [Ctrl]-[X] if you're using nano)
    • If you perform these steps on the default configuration that was included with the last release, it will now look like this
      • { 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";
        }
  6. Rebuild
    • sudo nixos-rebuild switch
  7. Reboot NixOS
    • In PowerShell run:
    • wsl -t NixOS
    • wsl -d NixOS

If you are using Flakes

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

Changelog

🛠️ General Changes

🚀 Features

🪲 Bugfixes

  • fix: getent missing in syschdemd (#267) @nzbr
  • fix: explicitly add systemctl and grep to path in shell-wrapper (#240) @K900
  • fix: just pull in the entire environment into the /bin/sh wrapper (#234) @K900
  • fix(installer): perl locale errrors (#228) @TeofilC
  • fix(split-paths): use standard library tools, fix shell quoting better (#219) @K900
  • fix: actually fix PATH filtering (#212) @K900
  • fix: ensure /nix/nixos-wsl exists before linking entrypoint (#208) @K900
  • fix: relink the X11 socket into place if needed (#207) @K900
  • fix: default user name isn't necessarily the same as user attr name (#204) @KoviRobi
  • fix: compatibility with latest WSL update (#199) @K900
  • fix: copy-launchers activation script (#181) @nzbr
  • fix(native-systemd): clean up /dev/shm correctly when it's a directory (#188) @K900
  • fix: flake lock (#186) @nzbr
  • fix: mount propagation (and also oomd) (#178) @K900
  • fix: X11 socket symlink creation (#172) @SuperSandro2000
  • fix: sudo ssh with jumpHost (#167) @SuperSandro2000
  • fix: permissions for files in /dev/pts (#166) @SuperSandro2000
  • fix: setting custom nameservers through networking.nameservers (#157) @nzbr
  • fix(native-systemd): pass arguments correctly (#170) @K900
  • fix: setup /bin/login for native systemd support (#169) @psmf
  • fix(syschdemd): exit code (#140) @nzbr
  • fix: disable module completely when wsl.enable = false (#151) @SuperSandro2000
  • fix(docker-native): switch nixpkgs.overlays to inline overlay (#150) @abehidek
  • fix: remove boot.isContainer (#145) @nzbr
  • fix: do not import minimal profile by default (#144) @SuperSandro2000

🧪 Tests

[22.05-5c211b47] The not-so-quick Quokka

18 Aug 18:34
0b29fc7
Compare
Choose a tag to compare

📢Please note

  • The 2.0.0.0 update of WSL breaks the old method we used to get systemd to run. For information on how to work around that, see #292
  • (Older WSL versions) 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.

Patch Notes

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

Updating

Flakes

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.

Installer

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

Legacy (pre-installer)

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

Changelog

🛠️ General Changes

🚀 Features

🪲 Bugfixes

  • docker-desktop: fix bind mounts (#117) @nzbr
  • interop: move to its own module and disable re-registration by default (#119) @nzbr
  • prevent systemd-tmpfiles from removing the xorg socket (#115) @nzbr
  • fix docker-desktop systemd proxy (#90) @hschaeidt
  • fix /bin/wslpath missing (#106) @nzbr
  • interop: fix hacks (#99) @K900
  • interop: enable preserveArgvZero (#84) @K900
  • Preserve UID for default user (#85) @ErikMcClure
  • Fix Windows File Systems not being mounted on first start when using the Installer (#79) @nzbr
  • Fix syschdemd failing on first launch with installer (#68) @nzbr

📖 Documentation

[21.11-d89f18a1] The Journey Continues!

30 Mar 19:27
47ab671
Compare
Choose a tag to compare

📢Please note

  • This release contains a known issue, that causes systemd to fail to start on first launch. For more information, see #67
    • EDIT: The problem has been resolved. Please use the nixos-wsl-installer-fixed.tar.gz attached to this release instead of the regular one
  • SHA256 checksums have been added for the attached files

Patch Notes

This 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!

Updating

Flakes

Switch your nixpkgs url to github:NixOS/nixpkgs/nixos-21.11 and run nix flake update

Installer

Replace the content of /etc/nixos/nixos-wsl with the content of the source-tarball attached to this release

Legacy (pre-installer)

Assuming that you followed the update procedure in the last release, replace refs/tags/20.09-1c1f5649 with refs/tags/21.11-d89f18a1

Changelog

🛠️ General Changes

🪲 Bugfixes

[20.09-1c1f5649] Back from the Dead!

25 Mar 01:01
f697e40
Compare
Choose a tag to compare

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".

Updating

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!

Changelog

🛠️ General Changes

🚀 Features

  • Yet another environment pass-through PR (#45) @ajgrf
  • Add support for WSLg (#39) @nzbr
  • Avoid having to run nix activate on first run (#26) @TeofilC
  • Set locale when running nix activate (#25) @TeofilC

🪲 Bugfixes

📖 Documentation

20.09-0cfd08f4881

21 Feb 00:20
Compare
Choose a tag to compare