From c0b246d3110161f8dd86188f78c97f9c1147cdd5 Mon Sep 17 00:00:00 2001 From: Spencer Brower Date: Thu, 6 Oct 2022 14:41:24 -0400 Subject: [PATCH] feat: Added defaults to vagrant. --- nixos/modules/virtualisation/vagrant.nix | 89 +++++++++++++----------- 1 file changed, 47 insertions(+), 42 deletions(-) diff --git a/nixos/modules/virtualisation/vagrant.nix b/nixos/modules/virtualisation/vagrant.nix index 60020d1..9a39513 100644 --- a/nixos/modules/virtualisation/vagrant.nix +++ b/nixos/modules/virtualisation/vagrant.nix @@ -1,47 +1,52 @@ { config, hostName ? "nixos", ... }: { - config = { - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + config = mkMerge [ + { + nix.settings.experimental-features = [ "nix-command" "flakes" ]; - virtualisation.virtualbox.guest.enable = true; + virtualisation.virtualbox.guest.enable = true; - # Mount a VirtualBox shared folder. - fileSystems."/vagrant" = { - fsType = "vboxsf"; - device = "vagrant"; - options = [ "rw,uid=1001,gid=60,_netdev" ]; # mount as vagrant:nginx - }; - - networking.hostName = hostName; - networking.extraHosts = '' - 127.0.0.1 ${config.networking.hostName}.local - ''; - - security.sudo.wheelNeedsPassword = false; - - users.users.root.password = "vagrant"; - users.users."vagrant" = { - isNormalUser = true; - password = "vagrant"; - extraGroups = [ - "nginx" - "wheel" - # Allow mounting of shared folders. - "vboxsf" - ]; - }; - - services.openssh.enable = true; - - services.avahi = { - enable = true; - publish = { - enable = true; - addresses = true; - workstation = false; + # Mount a VirtualBox shared folder. + fileSystems."/vagrant" = { + fsType = "vboxsf"; + device = "vagrant"; + options = [ "rw,uid=1001,gid=60,_netdev" ]; # mount as vagrant:nginx }; - }; - } /*// (mkIf services.laravel.enable { - services.laravel.root = mkDefault /vagrant; - services.laravel.domain = mkDefault (config.networking.hostName + ".local"); - })*/; + + networking.hostName = hostName; + networking.extraHosts = '' + 127.0.0.1 ${config.networking.hostName}.local + ''; + + security.sudo.wheelNeedsPassword = false; + + users.users.root.password = "vagrant"; + users.users."vagrant" = { + isNormalUser = true; + password = "vagrant"; + extraGroups = [ + "nginx" + "wheel" + # Allow mounting of shared folders. + "vboxsf" + ]; + }; + + services.openssh.enable = true; + + services.avahi = { + enable = true; + publish = { + enable = true; + addresses = true; + workstation = false; + }; + }; + } + mkIf + services.laravel.enable + { + services.laravel.root = mkDefault /vagrant; + services.laravel.domain = mkDefault (config.networking.hostName + ".local"); + } + ]; }