Rendered at 15:35:16 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
EnigmaCurry 22 hours ago [-]
I'm happy to see this, and I have lots of thoughts about this. Building declarative services on Nix is a far superior way of distributing Linux to VMs than most any other way I've tried. I am working [1] on very similar things, but I've been leaning more on the self-hosted path, my VM template targets libvirt and Proxmox VE with a single CLI api. I even have an experimental branch that targets DigitalOcean. For VMs especially, I want my OS to be immutable. My VMs should contain no state other than my application state. Upgrades should be a full image replacement and reboot.
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?
I tried out NixOS a few years ago but recently transitioned back to Rocky Linux and Ansible. I know that Nix is treasured by some but it always came across as an esoteric tool for functional programming idealists. I found the community to be split between people who were genuinely helpful and people who were just... not.
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.
bwm 19 hours ago [-]
Yea, I totally get it. The thing is agents change the game. You no longer need to worry about the learning curve or how best to implement.
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 :)
mplanchard 16 hours ago [-]
I do think the community recognizes this to be an issue and is steadily working on improving beginner-friendly docs. I am about seven years into using Nix for various things, and can mostly solve most problems, but I won’t deny that the learning curve at the beginning was brutal. The real and most meaningful unlock is learning to read the nix language well enough to follow what is happening, then checking out nixpkgs locally to look at crate derivations and such to understand what idioms exist in “real code.” The module system also took ages to click for me, but was a big unlock.
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.
bwm 22 hours ago [-]
Always happy to meet others that are working with NixOS :) I've just added the License - it's MIT.
setheron 22 hours ago [-]
Big fan of exe.dev so the added Nix seems like a solid value add.
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
bwm 22 hours ago [-]
Thanks! Yup, one of the benefits of defining your VMs as code using Nix, is that you can take that code to any supplier, and you're guaranteed exactly the same build.
You can still apply. People dropped out.
Reach out to me if you want. My email is in my website (see profile).
We leave Saturday to hack on Nix !
bwm 20 hours ago [-]
Would love to join the next one!
lavaman131 9 hours ago [-]
This looks really good. NixOS is a great operating system for reproducibility. I like also that you can spin up VMs via the CLI just as a convenience part too. This looks great for an individual developer. From the team perspective, if I create a golden snapshot of a dev env, is there a way within the product to sharae the image with others so they can spin it up instantly?
farfatched 16 hours ago [-]
> Every VM gets its own static IP
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.
bwm 16 hours ago [-]
You retain the IP as long as you keep the VM. If you delete it, you'll loose the IP.
nc 22 hours ago [-]
I’ve been using machine0 for hosting openclaw and a couple of web apps i’ve been working on. Great product super easy to use with claude code.
bwm 22 hours ago [-]
Been great having you :)
Pet_Ant 21 hours ago [-]
I wonder how easy this would be to port to Guix?
bwm 20 hours ago [-]
You could point your agent at the machine0 CLI and ask it to :)
GeoffNN 19 hours ago [-]
Very cool! I'll definitely check this out for auto-research like experiments, esp. with GPUs
bwm 18 hours ago [-]
Yes, it's ideal for this!
JeanEdern 22 hours ago [-]
How does machine0 handle NixOS state drift and recovery in practice—for example, if a VM is manually modified outside the flake, can I detect or reset that drift, and how do snapshots interact with flake-based provisioning?
bwm 21 hours ago [-]
It's not possible to modify the VM outside of the flake :)
JeanEdern 21 hours ago [-]
[dead]
Bnjoroge 20 hours ago [-]
Very cool. I have something similar set up for my homelab where I launch nixos incus containers. Been great for offloading stuff from the my agents
bwm 19 hours ago [-]
It's funny, because my homelab is exactly where this started :)
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.
bwm 20 hours ago [-]
I'm also a big fan of proxmox! Would be happy to help you extend machine0 though :) Happy to chat about your requirements over email: barnaby@machine0.io
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?
[1] https://github.com/EnigmaCurry/nixos-vm-template
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.
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 :)
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.
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
We leave Saturday to hack on Nix !
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.
It'll click faster if you learn with an agent!
https://github.com/cdevr/dtt
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.