-
Notifications
You must be signed in to change notification settings - Fork 0
/
behalter.nix
61 lines (57 loc) · 1.65 KB
/
behalter.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
{ config, pkgs, lib, ... }: {
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
recommendedOptimisation = true;
virtualHosts."behalter.domain.tld" = {
forceSSL = true;
enableACME = true;
locations."= /<changeme-prefix>/webhook/add" = {
extraConfig = ''
include ${config.services.nginx.package}/conf/uwsgi_params;
uwsgi_pass ${config.services.uwsgi.instance.socket};
access_log /var/log/nginx/behalter-access.log;
error_log /var/log/nginx/behalter-error.log;
'';
};
locations."/" = {
basicAuth = {
behalter = lib.removeSuffix "\n" "${builtins.readFile /etc/secrets/basicauth_behalter}";
};
extraConfig = ''
include ${config.services.nginx.package}/conf/uwsgi_params;
uwsgi_pass ${config.services.uwsgi.instance.socket};
access_log /var/log/nginx/behalter-access.log;
error_log /var/log/nginx/behalter-error.log;
'';
};
};
};
services.uwsgi = {
enable = true;
plugins = [ "python3" ];
instance = {
pythonPackages = self: with self; [
beautifulsoup4
flask
sqlalchemy
flask-sqlalchemy
pyuseragents
tzlocal
];
type = "normal";
socket = "127.0.0.1:8081";
module = "wsgi:app";
uid = "uwsgi";
gid = "uwsgi";
wsgi-file = "/var/lib/behalter/wsgi.py";
chdir = "/var/lib/behalter/";
master = true;
processes = 3;
vacuum = true;
logto = "/tmp/uwsgi.log";
};
};
}