2 ms·
Just today I was setting up a server for a side project and mulling over do I use ol' reliable Ubuntu+Ansible vs finally trying NixOS. I was very sad to see tha
by resonious 3y ago
Just today I was setting up a server for a side project and mulling over do I use ol' reliable Ubuntu+Ansible vs finally trying NixOS. I was very sad to see that all of the popular VPS services (Digital Ocean and the like) "no longer" officially support NixOS.
Linode was nice enough to have an official "how to set up NixOS on Linode" guide, but it requires fiddling with partitions by hand. At that point, I feel like all of the repeatability gains are gone. If I want to spin up a fresh server, I have to read a guide and set stuff up by hand? Could spend that same time setting up an Ubuntu by hand each time followed by git pull or scp to deploy. Ended up using Ansible in the end, as it really does let me just get a new VPS and deploy to it very fast when the time comes.
I wonder why the big providers once supported NixOS and then decided to stop!
- suchar 3y agoFor DigitalOcean (and several other providers) you can build your own image with provided configurations, e.g.: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/digital-ocean-image.nix https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/v... (see `virtualisation` folder for other providers) Then you can do something like: nix build .#nixosConfigurations.doImage.system.build.digitalOceanImage And in the `result` directory you will have droplet image which can be uploaded to digital ocean as droplet template. Its probably best to also create separate configuration only for the image. As a bonus, its already configured, so no need to run `nixos-rebuild switch` after droplet creation. Partitioning configuration is also handled by the builded, however, filesystem choice (and partitioning schema) is limited (I'm not saying that this is easier than out of the box support for NixOS: IMO if you are even aware how to create custom NixOS image then you are probably somewhat experienced NixOS user)
- rgoulter 3y agoThose Linode instructions are about installing an OS from an installation ISO from Linode's rescue mode. -- I'd consider that more a 'plus' to Linode that you get to be able to install whatever unsupported Linux on Linode's VMs. But, of course it's not as smooth as the officially supported images. Sibling comment mentions that nix has ways to build NixOS VM images (e.g. https://github.com/nix-community/nixos-generators https://github.com/nix-community/nixos-generators has a generator specifically for Linode). Another option is to use nixos-infect, which will replace a Linux distribution with a NixOS distribution. https://github.com/elitak/nixos-infect https://github.com/elitak/nixos-infect -- e.g. this blogpost discusses using nixos-infect to deploy NixOS for a cloud provider which doesn't have an official NixOS image. https://xeiaso.net/blog/nix-flakes-terraform https://xeiaso.net/blog/nix-flakes-terraform > At that point, I feel like all of the repeatability gains are gone. If I want to spin up a fresh server, I have to read a guide and set stuff up by hand? Just as with ansible, "git pull to deploy". You'd keep a copy of your NixOS configuration.nix somewhere else, and would be able to apply it later. > it really does let me just get a new VPS and deploy to it very fast Using a tool you're familiar with to get the job done is going to be faster than learning to use a tool you're unfamiliar with. I believe much of the use of NixOS is for hobby stuff, and for personal machines. (c.f. "In what environments do you use Nix", Development (1242) vs Home Server (845) vs Production (386) https://discourse.nixos.org/t/2022-nix-survey-results/18983 https://discourse.nixos.org/t/2022-nix-survey-results/18983).
- lillecarl 3y ago"I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones." Never underestimate hobby usage ;)
- resonious 3y agonixos-infect looks great. Don't know how I didn't find that. Might give it a shot. > Using a tool you're familiar with to get the job done is going to be faster than learning to use a tool you're unfamiliar with. I'm well aware of this and had the time to do some upfront investment. During that investment, it seemed hard to boil a fresh deploy down to a couple of clicks. Given the great responses I'm getting, that was probably wrong, but wasn't easy for me to figure out through simple web searches!
- pxc 3y ago> but it requires fiddling with partitions by hand Nowadays you can declare partitioning instructions with Nix just like the rest of the system: https://github.com/nix-community/disko https://github.com/nix-community/disko And you can use something like nixos-anywhere with it for a alternative process, if your provider isn't as cool as Linode and won't let you boot arbitrary ISOs: https://github.com/numtide/nixos-anywhere https://github.com/numtide/nixos-anywhere Building images directly for cloud vendors' platforms on your local system and then pushing them up and assigning them to VMs is probably nicer than actually installing NixOS in the cloud, though. See this comment's siblings for that :)