]>
Commit | Line | Data |
---|---|---|
1 | { pkgs ? import <nixpkgs> {} }: with pkgs; | |
2 | let | |
3 | greenapid = callPackage ./greenapid.nix {}; | |
4 | frontend = callPackage ./frontend.nix {}; | |
5 | nginx_conf = writeText "nginx.conf" '' | |
6 | pid ./nginx.pid; | |
7 | error_log stderr; | |
8 | daemon off; | |
9 | events { | |
10 | } | |
11 | http { | |
12 | include ${mailcap}/etc/nginx/mime.types; | |
13 | server { | |
14 | listen 0.0.0.0:8081; | |
15 | listen [::]:8081; | |
16 | location /api/ { | |
17 | proxy_set_header X-Real-IP $remote_addr; | |
18 | proxy_set_header Host $host; | |
19 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
20 | proxy_pass http://127.0.0.1:8080/; | |
21 | } | |
22 | location / { | |
23 | root ${frontend}; | |
24 | try_files $uri $uri/ /index.html; | |
25 | } | |
26 | } | |
27 | } | |
28 | ''; | |
29 | in | |
30 | pkgs.mkShell { | |
31 | buildInputs = [ | |
32 | greenapid | |
33 | frontend | |
34 | python2 | |
35 | nginx | |
36 | ]; | |
37 | shellHook = '' | |
38 | greenapid & | |
39 | pid=$! | |
40 | ||
41 | finish() { | |
42 | kill $pid; | |
43 | } | |
44 | ||
45 | trap finish EXIT | |
46 | ||
47 | nginx -c ${nginx_conf} -p ./nginx/ | |
48 | exit | |
49 | ''; | |
50 | } |