nixbox icon indicating copy to clipboard operation
nixbox copied to clipboard

virtualbox__intnet option in Vagrantfile smashes vagrant-network.nix

Open TheTesla opened this issue 6 years ago • 1 comments

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

TheTesla avatar Jul 31 '19 14:07 TheTesla

@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.

cdituri avatar Jun 06 '20 17:06 cdituri