Run the VM as
WWW="$PWD/www" nix run
to serve the www directory from within the VM.
28 lines
511 B
Nix
28 lines
511 B
Nix
{ pkgs, ... }: {
|
|
services = {
|
|
getty.autologinUser = "root";
|
|
nginx = {
|
|
enable = true;
|
|
virtualHosts.localhost.locations."/" = {
|
|
index = "index.html";
|
|
|
|
root = "/var/www";
|
|
};
|
|
};
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
|
|
virtualisation.forwardPorts = [{
|
|
from = "host";
|
|
guest.port = 80;
|
|
host.port = 8080;
|
|
}];
|
|
|
|
virtualisation.sharedDirectories.www = {
|
|
source = "$WWW";
|
|
target = "/var/www";
|
|
};
|
|
|
|
system.stateVersion = "23.11";
|
|
}
|