Add Nix VM configuration for local testing
This commit is contained in:
parent
131091a684
commit
04d4c17311
|
@ -1,2 +1,3 @@
|
||||||
/web-serve
|
/web-serve
|
||||||
*.pyc
|
*.pyc
|
||||||
|
/nixos.qcow2
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Nix configuration. Install and run with e.g. nixos-shell
|
||||||
|
# (https://github.com/Mic92/nixos-shell) to create and run this webserver.
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
virtualisation.qemu.networkingOptions = [
|
||||||
|
# We need to re-define our usermode network driver
|
||||||
|
# since we are overriding the default value.
|
||||||
|
"-net nic,netdev=user.0,model=virtio"
|
||||||
|
# Than we can use qemu's hostfwd option to forward ports.
|
||||||
|
"-netdev user,id=user.0,hostfwd=tcp::8080-:80"
|
||||||
|
];
|
||||||
|
|
||||||
|
nixos-shell.mounts = {
|
||||||
|
mountHome = false;
|
||||||
|
mountNixProfile = false;
|
||||||
|
extraMounts = {
|
||||||
|
"/var/www" = ./.;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
virtualHosts."localhost" = {
|
||||||
|
root = "/var/www/web-serve";
|
||||||
|
locations."/".extraConfig = ''
|
||||||
|
error_page 404 /404.html;
|
||||||
|
try_files $uri $uri.html $uri/ =404;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue