blob: 7622265497509a20405c072ad870188b3e16d8bf (
plain)
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
|
{ config, lib, pkgs, ... }:
# more than just nginx config but not enough to become a module
let
wsgi-sock = "${workdir}/uwsgi-photostore.sock";
workdir = config.services.uwsgi.runDir;
wifi-itf = "wlp2s0";
wifi-ip = "172.16.9.96";
in {
services.uwsgi = {
enable = true;
user = "nginx";
runDir = "/var/lib/photostore";
plugins = [ "python3" ];
instance = {
type = "emperor";
vassals = {
cameraupload-server = {
type = "normal";
pythonPackages = self: with self; [ pkgs.cameraupload-server ];
socket = wsgi-sock;
};
};
};
};
services.nginx = {
enable = lib.mkDefault true;
virtualHosts.${wifi-ip} = {
locations = {
"/".extraConfig = ''
expires -1;
uwsgi_pass unix://${wsgi-sock};
uwsgi_param UWSGI_CHDIR ${workdir};
uwsgi_param UWSGI_MODULE cuserver.main;
uwsgi_param UWSGI_CALLABLE app;
include ${pkgs.nginx}/conf/uwsgi_params;
'';
};
};
};
networking.firewall.allowedTCPPorts = [ 80 ];
# networking.interfaces.${wifi-itf}.ipv4.addresses = [{
# address = wifi-ip;
# prefixLength = 24;
# }];
networking.wireless = {
enable = true;
interfaces = [ wifi-itf ];
networks.Mobility = {
priority = -999;
psk = null;
};
};
}
|