-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo-nginx.nix
62 lines (58 loc) · 1.38 KB
/
demo-nginx.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{bundle}: {
config,
lib,
pkgs,
...
}: {
# personal preference
console = {
font = "Lat2-Terminus16";
keyMap = "de";
};
# enable easy login to root via console
users = {
mutableUsers = false;
users.root = {
password = "";
isSystemUser = true;
};
};
networking.firewall.enable = lib.mkForce false;
# map port 80 to 8080
virtualisation = {
qemu = {
networkingOptions = [
# We need to re-define our usermode network driver
# since we are overriding the default value.
"-net nic,netdev=user.1,model=virtio"
# Than we can use qemu's hostfwd option to forward ports.
"-netdev user,id=user.1,hostfwd=tcp::8080-:80"
];
};
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedBrotliSettings = true;
virtualHosts."localhost" = {
enableACME = false;
forceSSL = false;
root = "${bundle}/share/www";
extraConfig = ''
location / {
try_files $uri /index.html;
location /tiles/data/ {
gunzip on;
gzip_static on;
gzip_proxied expired no-cache no-store private auth;
}
}
location =/index.html {
alias ${./demo.html};
}
'';
};
};
}