-
Notifications
You must be signed in to change notification settings - Fork 3
/
container.nix
78 lines (72 loc) · 1.87 KB
/
container.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{ config, pkgs, ... }:
let xraypkg = (pkgs.callPackage ./default.nix {}); in
{
imports = [
./module.nix
];
services.postgresql.enable = true;
services.postgresql.package = pkgs.postgresql;
networking.nameservers = [ "8.8.8.8" "8.8.4.4" ];
networking.firewall.enable = false;
environment.systemPackages = with pkgs; [
apktool
python27Packages.gplaycli
];
services.xray.enable = true;
services.xray.package = xraypkg;
environment.etc."xray/config.json".text = ''
{
"geoipurl": "http://sociamnat.cs.ox.ac.uk:8003/geoip",
"datadir": "/var/lib/xray",
"unpackdir": "/tmp/unpacked_apks",
"credDownload": "/etc/xray/credentials.conf",
"db": {
"database": "xraydb",
"host": "localhost",
"port": 5432
},
"retriever": {
"db": {
"user": "postgres",
"password": "aaaaa"
}
},
"explorer": {
"db": {
"user": "postgres",
"password": "aaaaa"
}
},
"downloader": {
"db": {
"user": "postgres",
"password": "aaaaa"
}
},
"analyzer": {
"db": {
"user": "postgres",
"password": "aaaaa"
}
},
"apiserv": {
"db": {
"user": "postgres",
"password": "aaaaa"
}
},
"suggester": {
"db": {
"user": "postgres",
"password": "aaaaa"
}
}
}
'';
services.postgresql.initialScript = builtins.toFile "init_db.sql" (''
create database xraydb;
\connect xraydb
'' + (builtins.readFile "${xraypkg}/lib/xray/init_db.sql") + ''
alter user postgres with password 'aaaaa';
'');
}