It’s been almost 2 years since my last workstation setup post. At a high level, it hasn’t changed much, but it’s been a while, so I figured it’s a good time to share some updates.
Not much has changed on my Macbook setup.
Before jumping in to the NixOS VM, I want to point out a very important thing, that is I use Nix (with Home manager on top) as the package manager for both MacOS and NixOS. This allows me to have a consistent user environment across both systems. Tools like
git
,zsh
,gpg
, and many other cli tools I can set up once and use everywhere.
I have tried a few different setups, like using VirtualBox or VMware Fusion with NixOS + i3. Maybe I did something wrong, or didn’t spend enough time to work out the spice-vdagent
issue, or the HiDPI config on NixOS, so I always end up going back to UTM + NixOS (via SSH) setup. This setup has worked really well for me last 2 years, so maybe there is less motivation for me to try something new.
Clone this repo if you want to try it yourselve.
Step 1-3 is simply install a minimal NixOS (no desktop environment) in which root
user has password as root
. The result of these steps is this NixOS UTM template that I’ve created and used myself. You can download and use it directly, or follow the steps below to create your own.
Use UTM to create a new VM with the following settings:
10240
(on 16GB host)8
(on 10-core host)100GB
NixOS
Emulated VLAN
with Port Forwarding on port 22Start the VM and set root password as root
$ sudo -i
$ passwd
$ make install
Once finish installing, shutdown the VM, remove bootable ISO, then start the VM again.
Before continuing step 4, make sure to check out the
Makefile
and./vm/bootstrap.nix
and make necessary changes to your custom details. This step will create new OS user, copy secrets (GPG keys), config Tailscale, install home-manager, neovim, etc. Most of them are optional, so you can remove what you don’t need.
$ make bootstrap
That’s it. It’s all good to go. You can now SSH into the VM and start using it.