nix-community / nixbox

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

virtualbox__intnet option in Vagrantfile smashes vagrant-network.nix #45

Open TheTesla opened 5 years ago

TheTesla commented 5 years ago

Having this in Vagrantfile:

subconfig.vm.network "private_network", ip: "192.168.80.10", virtualbox__intnet: "mynetwork"
subconfig.vm.network "private_network", ip: "192.168.90.4"

makes a vagrant-network.nix:

{ config, pkgs, ... }:
{
  networking.interfaces = [
    { 
      name         = "enp0s8";
      prefixLength = 24;
    }
    { 
      name         = "enp0s9";
      ipAddress    = "192.168.90.4";
      prefixLength = 24;
    }
  ];
}

You see: The ip address is missing for enp0s8

cdituri commented 4 years ago

@TheTesla looks like the vagrant/templates/guests/nixos/network template is expecting a network ip of explicit type static.

As to why the other entry works, unsure. I would wager it has to do with how vagrant is handling virtualbox__intnet in its implementation. If you add virtualbox__intnet: "mynetwork" to both statements do they both fail to inline an ip? That would be my expectation based on above hypothesis.

As for a workaround, give the following a try in your Vagrantfile:

subconfig.vm.network "private_network", type: "static", ip: "192.168.80.10", virtualbox__intnet: "mynetwork"
subconfig.vm.network "private_network", ip: "192.168.90.4"

If this works and you'd like to be fully explicit simply add another type: "static" to your second, non virtualbox__intnet, interface.