nixos-in-production/module.nix
Alexander Kobjolke ab3cc0c217 vm: Serve www directory from a shared directory
Run the VM as

    WWW="$PWD/www" nix run

to serve the www directory from within the VM.
2024-01-14 21:52:48 +01:00

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";
}