Closed ThomasMader closed 2 years ago
Just as a recap:
I just wanted to communicate clearly that it's not just a small patch away.
From there, there are two routes possible:
IMO option (2) is much better to avoid giving a false expectations. It's definitely a project but it's not completely insurmountable to do.
You don't get to choose the linux kernel and there is no init system
You actually can import your own kernel for the past 2 or 3 Insider builds. There's a few other things as well. See the blogs. And there is an init system. There's just not systemd without genie. Create init.rc scripts and you'll have the same as having systemd. This would be a bit more challenging for several obvious reasons. But it's doable.
Also, NX-OS would still have to work on WSL1 as that is the default even after enabling WSL2. But it's still the same as my last comment.
There's just not systemd without genie. Create init.rc scripts and you'll have the same as having systemd. This would be a bit more challenging for several obvious reasons. But it's doable.
This would be the way to go IMHO, this isn't specific to WSL:
https://github.com/NixOS/nixpkgs/issues/26067 https://github.com/NixOS/nixpkgs/issues/26850
I don't pretend to understand enough about linux, wsl, and systemd to know if this is useful, but there's a long thread about systemd on WSL2 here that might have some useful information
I will note that I've seen plenty of init.rc scripts that including calling systemctl and other systemd functions (we have some for a few Fedora VMs/containers due to things used for managing the hosts.) So the functionality can remain exactly the same except you can add to the scripts other non-systemd stuff so if you don't have systemd, you don't run any of the systemd specific stuff. For redundancies found within a script, those should be abstracted away as much as possible to keep the file size down as well as possibly improve perf from not having to read so many lines. We do want to keep these scripts as small as possible following best coding practices.
I looked into Genie and figured out how it's running systemd. I then wrote a NixOS module to wrap systemd and systemctl instead:
https://github.com/puffnfresh/nixpkgs/commit/08d8c23eebb0a5ab90db94a05e297630227cb232
It's somewhat working. Sometimes systemd starts up well and you can run systemctl to check on services, etc. It seems like nixos-rebuild switch
mostly doesn't work, sadly. Still quite a bit of debugging to do.
Whilst the nixos-rebuild switch
is a bit of a shame, I think it's less important on WSL2 as the reboot time is only 1-2 seconds anyway.
Looks like somebody has it working 100% here, but I haven't tried it out yet https://github.com/Trundle/NixOS-WSL
Systemd now has the --system flag which lets it run even if it doesn't have PID 1, so maybe all we need to do is set that flag?
lol? I run a non systemd distro, and I have no issues with running systemd inside containers (non pid 1) fully non degraded, so didn't even systemd needed such flag? Out of curiousity, why on EARTH would anyone want / need to run linux on windows and not vice versa? Is it basically an update to cygwin or so? 2020? ye, 20 year late MS.. 90s os :) what is WSL?
OH.. NixOS as I understood it was meant to be so 'smart about running several versions' but it can't even handle different inits? I understand one can blame systemd for that, but it's usually easier to run all good citizens together, as options, and leave the one bad one out. Still, I guess NixOS , despite having grown, isn't really all that then.
@lulcat The init system used to be upstart iirc, feel free to find those commits and propose a maintainable combined system. There's also a lot to read in previous issues on this topic.
The gist of it is that it's hard to create a wrapper around init systems with such diverse capabilities without being very limiting or re-writing systemd capabilities; as such, NixOS modules use only systemd.
Seems like it works now. Any news on a possible release on the Microsoft Store ?
At the very least, an offline msix could be provided (that's still signed) to make usable outside of Store. The wsl --import option is great but an offline msix would be even greater.
I marked this as stale due to inactivity. → More info
Not Stale - still not in the Store
Are there any specific instructions for planting it into the WSL? Preferably, ones which do not involve writing an app in C++ and compiling it with Visual Studio. Everything there sounds not too hard — if you've done it before, and got all the tooling. But for the first time…
If not in the Store, a ready set of the DistroLauncher and install.tar.gz
would be nice to have.
Rumors are, you can install an install.tar.gz
by placing it alongside an Ubuntu.exe
and running, but the part which says "It is expected that /nix/var/nix/profiles/system/activate is run during installation, for example as part of the DistributionInfo::CreateUser function" sounds as if it could be a problem.
Another issue is that you need NixOS to make a tar.gz you need to run NixOS, which in context of our task (running NixOS on Windows NT) sounds close to "unzip.zip".
@GuillaumeDesforges or @WSLUser , do you know if anyone actually have tried to get this into Windows Store? Is there a request I could give thumbs up to somewhere? (don't know anything about how windows store works) ..
@GuillaumeDesforges or @WSLUser , do you know if anyone actually have tried to get this into Windows Store? Is there a request I could give thumbs up to somewhere? (don't know anything about how windows store works) ..
From @ghuntley (https://github.com/NixOS/nixpkgs/issues/30391#issuecomment-411413299)
In private discussions with Microsoft about getting NixOS into the Microsoft App Store. Have been a little overwhelmed recently but it's high on my todo list. Microsoft are waiting on me.
Other than that idk.
It would help to have someone who knows the procedure to be accountable (maybe a strong word but I don't know another) on this (both follow technical issues and WS request)
Seems like it works now. Any news on a possible release on the Microsoft Store ?
It would be great to have some manual steps to get it running as well. Is https://github.com/Trundle/NixOS-WSL the recommended way for example?
Is following the Trundle's repo still the best way to generate latest NixOS for WSL? Or are some forks or other repos that have 20.09+ images available? Possibly with WSLg, wslu support etc.
I commented in that repo that distrod claims to help with the systemd issue. Distrod relies on https://linuxcontainers.org which doesn't have anything for NixOS. Would it be difficult to create NixOS images for LXC/LXD and linuxcontainers.org so that distrod could be leveraged?
I'm running NixOS on lxd, but tbh it's not straight forward and you need to configure quite a lot in os level. There's also https://github.com/nix-community/nixos-generators which is able to generate LCD images.
19 Jan 2022 19:29:32 Alex Vorobiev @.***>:
I commented[https://github.com/Trundle/NixOS-WSL/issues/49#issue-1060671729] in that repo that distrod[https://github.com/nullpo-head/wsl-distrod] claims to help with the systemd issue. Distrod relies on https://linuxcontainers.org which doesn't have anything for NixOS. Would it be difficult to create NixOS images for LXC/LXD and linuxcontainers.org so that distrod could be leveraged?
— Reply to this email directly, view it on GitHub[https://github.com/NixOS/nixpkgs/issues/30391#issuecomment-1016750091], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AALKAEDI6ZDLGPL46XSEZ5DUW37IZANCNFSM4D7CYYCQ]. Triage notifications on the go with GitHub Mobile for iOS[https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675] or Android[https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub]. You are receiving this because you are subscribed to this thread. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAABCCAYAAADjVADoAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAAnSURBVHic7cEBDQAAAMKg909tDwcUAAAAAAAAAAAAAAAAAAAAAPBjRFIAASHKmKkAAAAASUVORK5CYII=###24x24:true###][Tracking image][https://github.com/notifications/beacon/AALKAEE5NVSY4ERUC2A52Z3UW37IZA5CNFSM4D7CYYC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHSNGACY.gif]
The nixos-wsl repo under nix-community is under a new maintainer and getting a lot of much-needed attention. There’s a good chance that we can get this done, soon.
https://github.com/nix-community/NixOS-WSL/issues/63
Please close this and redirect discussion here.
Closing as requested. Feel free to reopen if it is not appropriate.
Nix already runs in Ubuntu via WSL afaik. I think it would make sense to add an official NixOS image to the Windows Store. Arch Linux is trying already. (https://github.com/Microsoft/BashOnWindows/issues/2253)
Are there any showstoppers?