It is all started from this tweet.
Mitchell Hashimoto@mitchellhI switched my primary dev environment to a graphical NixOS VM on a macOS host. It has been wonderful. I can keep the great GUI ecosystem of macOS, but all dev tools are in a full screen VM. One person said “it basically replaced your terminal app” which is exactly how it feels.16:48 PM - 04 Jan 2021
Even though I'm already pretty happy with macOS itself. I was intrigued about using (and learning) NixOS in a way he would.
Oh boy. Let me tell you, it's not straightforward at all.
You can download ISO image from here, https://nixos.org/download.html
And (attempt to) install it via creating a new VM with the image.
Please tell me that I wasn't the only one that was completely lost after booting via the (CD) image.
After clicking this and that and rebooting SEVERAL times, my poor soul later discovered that there is actually no (automatic) installation is provided by this image, unlike Ubuntu! I have to do that all by myself!
Alright, maybe it's time to learn all the low-level goodies of doing everything from scratch. Let me read the documentation, https://nixos.org/manual/nixos/stable/index.html#sec-installation.
You know what, I'm not ready to do that just yet especially when I just wanted to have a taste of what it's like to use it as a guest VM (on VMWare Fusion).
Thanks to this blog, https://davedellacosta.com/posts/2019-03-29-why-nixos-is-hard-and-how-to-fix.html I feel better about myself not being able to do this as if it was a trivial thing. Also, it links me to https://nixos.wiki/wiki/NixOS which introduced me to https://github.com/jeaye/nixos-in-place.
nixos-in-place sounds all nice but I would still need another VM that is already installed with other distros if I were to avoid installing anything.
You know what? VMWare actually can import VirtualBox VM and NixOS provides ready-to-run VM on VirtualBox already. Why don't I just import it?
Yes, it worked.
Whether you are playing with the pure ISO image or imported VM for VirtualBox, you will soon notice one thing that is very annoying. Which is your mouse gets trapped in VM as soon as you hover your mouse on VM.
I got a hint here though about what to do. https://discourse.nixos.org/t/nixos-as-vmware-guest/7441 which was not very straightforward as a newcomer to NixOS. But I still found out what to do with googling. You will need to add in a configuration file via
[sudo] nano /mnt/etc/nixos/configuration.nix
Once you edited that, you can apply this by
sudo nixos-rebuild switch. You will probably also have to reboot your (virtual) machine via
reboot. After that, amazingly your mouse doesn't get trapped anymore 🎉.
That's good enough for me to feel I accomplished something today, I guess 😅.
Btw, if you didn't know or worried about the cost of VMWare instead of the free of charge that VirtualBox offers, VMWare Fusion actually offers a free license as well, https://my.vmware.com/web/vmware/evalcenter?p=fusion-player-personal