NixOS guest? #430
Replies: 8 comments 26 replies
-
Yes, it would! 😄 The first step is to find a somewhat stable/official location to download cloud images from. The second step is implementing support for the package manager in The third step is trying it out, checking if something is broken, and fixing it. 😈 |
Beta Was this translation helpful? Give feedback.
-
great! I think I already roughly know how to do the first step, to create a working qemu image and install additional stuff, via a script, starting from the official/current NixOS .iso image (pulling it from the NixOS archive). I will put this together over the holidays and report back. I am however pretty hazy about the next steps, and will have to look at the repository in detail to see how it works with alpine or arch linux and go from there. I am far from an expert though, help will be much appreciated! |
Beta Was this translation helpful? Give feedback.
-
Just a quick note that there are 2 different scenarios: booting from an image vs. booting from an ISO. We latter is only done for Alpine right now, and we build a custom ISO to make sure it includes cloud-init (or our own lima-init replacement). Most ISOs are either install or rescue media and do not support this. There is special code in Lima to mount a persistent data volume and move some directories to it, so they survive a reboot. This code probably will need some adjustments if you want to boot NixOS from an ISO instead of a regular image. Let me know if you run into any issues, and I'll try to help out! |
Beta Was this translation helpful? Give feedback.
-
Apparently NixOS thinks that https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/system/cloud-init.nix I don't think it is the python3 itself that is the biggest bloat, but it (ci) does have a truckload of dependencies... |
Beta Was this translation helpful? Give feedback.
-
Also registering interest in this development! |
Beta Was this translation helpful? Give feedback.
-
Today i created my nixos image https://github.com/patryk4815/ctftools/tree/master/lima-vm |
Beta Was this translation helpful? Give feedback.
-
I have found two projects for building Lima-compatible NixOS images on GitHub that are inspired by @patryk4815 's work:
|
Beta Was this translation helpful? Give feedback.
-
Back in July I wrote:
My nixos Lima VM that I installed with @patryk4815 's build is now broken -- DNS is not working in the guest. I'm not sure what broke it as I have upgraded both NixOS inside the guest as well as Lima (using Nix Home Manager) on the host. I didn't notice the problem until I restarted the guest VM. There are now at least 4 repositories listed above based on @patryk4815 's original work each with some user-specific customization and various fixes. I found a few more on GitHub. Some have added what look like useful features, but IMHO none of them looks like an ongoing project that other people can use and/or contribute to. Several look like they have made useful enhancements but IMHO none of them meet the criteria I am looking for to build a NixOS LimaVM that I could use for serious work. My criteria are:
Now it's easy to be a critic. The people developing these modules clearly know much more about Nix than I and they have made no promises of support and are clearly under no obligation. And I have limited bandwidth so I don't think I would be able to create neat another repository to solve the issues. I'm just hoping that maybe a few of us can get together and combine our efforts to produce something the community can use and can be maintained long term. Looking at the individual efforts made on the various forks seems to indicate there is enough interest and talent to make this happen. To this Nix novice, it seems like the best approach would be to create (one or more) flakes/modules that can be used to do the core Lima-related magic necessary to emulate
There could then be a separate template repo/flake that shows how to build a starter Lima-compatible image. Decoupling the module(s) from the starter/template repo would make it easier for people to customize to their hearts content, but be able to share the Lima modules and contribute upstream to improve them. Does this make sense? (I'm going to try tagging various people that have forked @patryk4815 's repo and see if we can get some discussion here...) |
Beta Was this translation helpful? Give feedback.
-
I would really love to have a NixOS guest -- at the moment I use lima with the nix package manager on an archlinux guest. I think in theory NixOS should work, looking at the stated requirements. I also have a qemu NixOS VM, that works just fine. It does not have the great lima integration features, so I really want it running from lima.
I guess the best way forward would be to just go ahead and do it myself, but I am new to lima and could not (easily) find a thread how to start. Are there some example instructions somewhere, or where should I look to e.g. how it was done for archlinux or Debian?
Any pointers are much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions