nix-community / nixbox

NixOS Vagrant boxes [maintainer=@ifurther]
https://app.vagrantup.com/nixbox/
MIT License
304 stars 101 forks source link

Replace Packer with Nix #96

Open zimbatm opened 6 months ago

zimbatm commented 6 months ago

This is just an idea. The main downside would be that the user needs to have Nix installed, but Nix builds are generally faster, and don't require the virtualization framework to build the images. That means it would be easier to target VMWare, HyperV, VirtualBox, ...

I have a prototype somewhere in this repo I think. And also pushed this to nixpkgs a while back: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/vagrant-guest.nix and https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/vagrant-virtualbox-image.nix

If you're interested of me going more in details @ifurther , let me know.

ifurther commented 6 months ago

Sorry late replay. I think this is good for user with nix, maybe could combine together. Sometimes users can select Packer and Nix to build in other systems.

zimbatm commented 6 months ago

Ok. Is this something you're interested in pursuing? Probably, it wouldn't make sense to have both Packer and Nix recipes as it would duplicate all of the work.

ifurther commented 6 months ago

Maybe the packer cloud stay in code, and new part using nix. I think some people may use the packer, and old code should help it. Dose using ci with nix to build image?

zimbatm commented 6 months ago

Up to you. They can also pull the latest image and then use Vagrant + Nix to build new custom images. Yes, we can have GitHub Actions build the images with Nix. Not sure about publishing on vagrantcloud, this part might have to be reverse-engineered.

ifurther commented 6 months ago

Maybe we can use new branch to check it

Et7f3 commented 5 months ago

Also it would allow to have nixos without vagrant-nixos-plugin plugin. Since we could build/share using the host.