tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
v2raya: v2rayA should start after nftables
Elliot
3 years ago
e78f2115
42f462e3
+30
-19
1 changed file
expand all
collapse all
unified
split
nixos
modules
services
networking
v2raya.nix
+30
-19
nixos/modules/services/networking/v2raya.nix
reviewed
···
12
12
config = mkIf config.services.v2raya.enable {
13
13
environment.systemPackages = [ pkgs.v2raya ];
14
14
15
15
-
systemd.services.v2raya = {
16
16
-
unitConfig = {
17
17
-
Description = "v2rayA service";
18
18
-
Documentation = "https://github.com/v2rayA/v2rayA/wiki";
19
19
-
After = [ "network.target" "nss-lookup.target" "iptables.service" "ip6tables.service" ];
20
20
-
Wants = [ "network.target" ];
21
21
-
};
15
15
+
systemd.services.v2raya =
16
16
+
let
17
17
+
nftablesEnabled = config.networking.nftables.enable;
18
18
+
iptablesServices = [
19
19
+
"iptables.service"
20
20
+
] ++ optional config.networking.enableIPv6 "ip6tables.service";
21
21
+
tableServices = if nftablesEnabled then [ "nftables.service" ] else iptablesServices;
22
22
+
in
23
23
+
{
24
24
+
unitConfig = {
25
25
+
Description = "v2rayA service";
26
26
+
Documentation = "https://github.com/v2rayA/v2rayA/wiki";
27
27
+
After = [
28
28
+
"network.target"
29
29
+
"nss-lookup.target"
30
30
+
] ++ tableServices;
31
31
+
Wants = [ "network.target" ];
32
32
+
};
33
33
+
34
34
+
serviceConfig = {
35
35
+
User = "root";
36
36
+
ExecStart = "${getExe pkgs.v2raya} --log-disable-timestamp";
37
37
+
Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ];
38
38
+
LimitNPROC = 500;
39
39
+
LimitNOFILE = 1000000;
40
40
+
Restart = "on-failure";
41
41
+
Type = "simple";
42
42
+
};
22
43
23
23
-
serviceConfig = {
24
24
-
User = "root";
25
25
-
ExecStart = "${getExe pkgs.v2raya} --log-disable-timestamp";
26
26
-
Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ];
27
27
-
LimitNPROC = 500;
28
28
-
LimitNOFILE = 1000000;
29
29
-
Restart = "on-failure";
30
30
-
Type = "simple";
44
44
+
wantedBy = [ "multi-user.target" ];
45
45
+
path = with pkgs; [ iptables bash iproute2 ]; # required by v2rayA TProxy functionality
31
46
};
32
32
-
33
33
-
wantedBy = [ "multi-user.target" ];
34
34
-
path = with pkgs; [ iptables bash iproute2 ]; # required by v2rayA TProxy functionality
35
35
-
};
36
47
};
37
48
38
49
meta.maintainers = with maintainers; [ elliot ];