fix: Added a check for vagrant.

This commit is contained in:
Spencer Brower
2022-11-02 17:20:48 -04:00
parent b0f602baa8
commit 8d533df068
2 changed files with 25 additions and 12 deletions

View File

@@ -1,10 +1,22 @@
{
description = "A very basic flake";
description = "Utilities for running Laravel, particularly with Vagrant";
outputs = { nixpkgs, self }: {
nixosModules = {
laravel = import ./nixos/modules/web-apps/laravel.nix;
vagrant = { ... }: { imports = [ ./nixos/modules/virtualisation/vagrant.nix ]; };
};
checks."x86_64-linux".vagrant = let pkgs = nixpkgs.legacyPackages."x86_64-linux"; in
pkgs.nixosTest {
name = "vagrant-box-test";
nodes.machine = { pkgs, ... }: { imports = with self.nixosModules; [ vagrant ]; };
testScript = ''
# run hello on machine and check for output
machine.succeed('hello | grep "Hello, world!"')
machine.succeed('goodbye | grep "Hello, world!"')
# test is a simple python script
'';
};
};
}

View File

@@ -2,6 +2,9 @@
let cfg = config.services.laravel;
in
{
imports = [
../web-apps/laravel.nix
];
config = lib.mkMerge [
{
nix.settings.experimental-features = [ "nix-command" "flakes" ];
@@ -15,10 +18,10 @@ in
options = [ "rw,uid=1001,gid=60,_netdev" ]; # mount as vagrant:nginx
};
networking.hostName = hostName;
networking.extraHosts = ''
127.0.0.1 ${config.networking.hostName}.local
'';
# networking.hostName = hostName;
# networking.extraHosts = ''
# 127.0.0.1 ${config.networking.hostName}.local
# '';
security.sudo.wheelNeedsPassword = false;
@@ -56,12 +59,10 @@ in
cd /vagrant;
'';
}
(lib.mkIf
cfg.enable
{
services.laravel.root = lib.mkDefault "/vagrant";
services.laravel.domain = lib.mkDefault (hostName + ".local");
services.laravel.user = lib.mkDefault "vagrant";
})
(lib.mkIf (cfg.enable == true) {
services.laravel.root = lib.mkDefault "/vagrant";
# services.laravel.domain = lib.mkDefault (hostName + ".local");
services.laravel.user = lib.mkDefault "vagrant";
})
];
}