Vagrant: Difference between revisions

imported>Lheckemann
No edit summary
imported>GeFrIt42
No edit summary
Line 6: Line 6:


=== Using NFS mounts ===
=== Using NFS mounts ===
Add to your <tt>Vagrantfile</tt>:
<syntaxhighlight lang="Ruby">
  # Mount a folder inside the VM.
  config.vm.synced_folder "myfolder/", "/mnt/myfolder", type: "nfs", nfs_version: 4
</syntaxhighlight>


Add to your <tt>configuration.nix</tt>:
Add to your <tt>configuration.nix</tt>:
Line 13: Line 19:
   # Minimal configuration for NFS support with Vagrant.
   # Minimal configuration for NFS support with Vagrant.
   services.nfs.server.enable = true;
   services.nfs.server.enable = true;
 
  # Add firewall exception for VirtualBox provider
   networking.firewall.extraCommands = ''
   networking.firewall.extraCommands = ''
     ip46tables -I INPUT 1 -i vboxnet+ -p tcp -m tcp --dport 2049 -j ACCEPT
     ip46tables -I INPUT 1 -i vboxnet+ -p tcp -m tcp --dport 2049 -j ACCEPT
   '';
   '';
  # Add firewall exception for libvirt provider when using NFSv4
  networking.firewall.interfaces."virbr1" = {                                 
    allowedTCPPorts = [ 2049 ];                                             
    allowedUDPPorts = [ 2049 ];                                             
  };   
}
}
</syntaxhighlight>
</syntaxhighlight>