Show HN: machine0 – Persistent NixOS VMs You Control from the CLI
Posted by bwm 1 day ago
Hi HN! Excited to launch machine0, a CLI that makes it easy to create, provision and snapshot persistent NixOS (& Ubuntu) VMs.
You can think of machine0 as a modern VPS provider. VMs stay on unless switched-off (with 99.99% uptime), they have static IPs and HTTPS endpoints, 1-60 vCPU, up to 240GB RAM and optionally GPUs. The CLI provides commands to manage lifecycle, snapshots and also provision the VMs using Nix flakes or Ansible playbooks. VMs are priced by the minute of usage.
What makes machine0 unique is that it has first class support for NixOS! In a nutshell, NixOS lets you define your entire OS as code (think Terraform but for your Linux). A flake declares your system state (packages, services, firewall rules, users...) and pins all dependencies via a lockfile. Given the same flake.nix and flake.lock, `nixos-rebuild switch` always produces the exact same system.
The NixOS ecosystem is mature, and flakes are expressive: at the system level you can define packages, what's in /etc, firewall rules, users & groups etc. At the user level, you can define your shell, aliases, tmux and vim config. Having your entire environment defined as code makes it easy to audit what's installed and how things are set up. You can rollback by reverting the last commit. And agents can write the code for you and test it against disposable machine0 VMs.
If you'd like to dive right in, these commands will get you started:
npm install -g @machine0/cli
machine0 new my-vm --image nixos-25-11 # create a new nixos VM
machine0 provision my-vm ./flake#my-profile # provision it using a nix flake
machine0 ssh my-vm # ssh in
machine0 stop my-vm # stop the VM
machine0 images new my-vm my-snapshot # create a snapshot
machine0 new my-clone --image my-snapshot # create a new VM from the snapshot
- Demo of installation + NixOS provisioning via Claude Code: https://www.youtube.com/watch?v=RT8N0_e3Vfg- Documentation: https://docs.machine0.io/introduction/overview
- machine0 NixOS flakes: https://github.com/fdmtl/machine0-nixos
If you're in the habit of using VMs, or want to know what the NixOS fuss is about, would love for you to give machine0 a try!
Comments
Comment by EnigmaCurry 1 day ago
So in my template, I have created the VMs with two disks: first one is for NixOS and is built from an image, and it is read-only. The second is mounted to /var and is used for all system configuration as well as application state. If I have multiple VMs, they can all share the same base image (thin provisioned). That's the mode that I want for my deployments of services, immutable and as stateless as possible. For agent use, its different, you actually want a mutable NixOS root so that the agent can do what it wants.
I built three modes: immutable, semi-mutable, and mutable. mutable removes the read-only lock on the root, and just lets you manage the VM as a pet. semi-mutable adds an ephemeral overlayfs that gets wiped the next time you upgrade the base image. So that gives you kind of the best of both worlds: an immutable read-only base image and the ability to "nix profile add" whatever you (or your agent) wants, but with the contract that these imperatively installed things will disappear the next time you upgrade. Are you planning on adding a LICENSE to your machine0-nixos repo?
Comment by OhSoHumble 1 day ago
I found Nix just really hard to work with. The documentation was just so poor and every aspect of Nix just seemed to be divorced from pragmatism.
An example of this, years ago, was that I wanted to do something VERY simple: codify the creation of a directory in NixOS. It took me 6 HOURS to find the relevant code for doing that. I couldn't even get an answer out of the Discord server.
I don't know if I'll ever pick it up again. The learning curve was incredibly steep and it's just not on job descriptions and I've never worked in a shop that has used it. I tried it out as a curiosity, found that it was hair pullingly frustrating to use, and moved on.
Comment by bwm 1 day ago
Just point your agent at a machine0 VM and say "make a machine that does X", then you get code you can use to build on any nix box and you'll always get the same result.
Once you experience this, it's hard to go back to a "traditional" OS, you'll want to nixify everything :)
Comment by mplanchard 1 day ago
Anyway, I hope the community continues to make the onboarding process more welcoming and easy. Personally, I am hopeful that guix will really take off at some point, because even though I get it now, I’d way rather read lisp than nix.
Comment by bwm 1 day ago
Comment by setheron 1 day ago
exe.dev is great but lurking in my mind is: "how will I replicate this if I ever need to move to AWS etc.." for all the service composition.
Site looks great too
Comment by bwm 1 day ago
Comment by setheron 1 day ago
Comment by gausswho 1 day ago
Comment by setheron 1 day ago
We leave Saturday to hack on Nix !
Comment by bwm 1 day ago
Comment by nc 1 day ago
Comment by bwm 1 day ago
Comment by farfatched 1 day ago
How does this interact with per-minute pricing?
If I have a machine that's on for 1 minute per month, do I retain an IPv4 address for the whole month?
Or is it IPv6-only?
I recall exe.dev addressed this by not having static IPs, and instead only allowing SNI/SSH proxying to hosts.
Comment by bwm 1 day ago
Comment by lavaman131 1 day ago
Comment by Pet_Ant 1 day ago
Comment by bwm 1 day ago
Comment by GeoffNN 1 day ago
Comment by bwm 1 day ago
Comment by JeanEdern 1 day ago
Comment by Bnjoroge 1 day ago
Comment by bwm 1 day ago
Comment by nightfuryg 18 hours ago
Comment by discova 1 day ago
Comment by bwm 1 day ago
It'll click faster if you learn with an agent!
Comment by cdevr 1 day ago
I mean, I'm not going to claim it's remotely near the same quality. And proxmox has some holes in their support for cloud init. And of course you need a mini pc on a good internet connection or the like.
But extremely fast provisioning of a any of VMs ... very handy.
Proxmox has too many compromises though. Maybe I should do the reverse, and extend this until it can fully replace proxmox entirely.
Comment by bwm 1 day ago
Comment by n3mo-dev 1 day ago
Comment by bwm 1 day ago
Comment by yapancha 1 day ago
Comment by bwm 1 day ago
Comment by dizhn 1 day ago