v2raya: v2rayA should start after nftables

This commit is contained in:
Elliot 2023-02-03 10:22:23 +08:00
parent 42f462e387
commit e78f2115bf
No known key found for this signature in database
GPG key ID: 35C664170DA93A99

View file

@ -12,27 +12,38 @@ with lib;
config = mkIf config.services.v2raya.enable { config = mkIf config.services.v2raya.enable {
environment.systemPackages = [ pkgs.v2raya ]; environment.systemPackages = [ pkgs.v2raya ];
systemd.services.v2raya = { systemd.services.v2raya =
unitConfig = { let
Description = "v2rayA service"; nftablesEnabled = config.networking.nftables.enable;
Documentation = "https://github.com/v2rayA/v2rayA/wiki"; iptablesServices = [
After = [ "network.target" "nss-lookup.target" "iptables.service" "ip6tables.service" ]; "iptables.service"
Wants = [ "network.target" ]; ] ++ optional config.networking.enableIPv6 "ip6tables.service";
}; tableServices = if nftablesEnabled then [ "nftables.service" ] else iptablesServices;
in
{
unitConfig = {
Description = "v2rayA service";
Documentation = "https://github.com/v2rayA/v2rayA/wiki";
After = [
"network.target"
"nss-lookup.target"
] ++ tableServices;
Wants = [ "network.target" ];
};
serviceConfig = { serviceConfig = {
User = "root"; User = "root";
ExecStart = "${getExe pkgs.v2raya} --log-disable-timestamp"; ExecStart = "${getExe pkgs.v2raya} --log-disable-timestamp";
Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ]; Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ];
LimitNPROC = 500; LimitNPROC = 500;
LimitNOFILE = 1000000; LimitNOFILE = 1000000;
Restart = "on-failure"; Restart = "on-failure";
Type = "simple"; Type = "simple";
}; };
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = with pkgs; [ iptables bash iproute2 ]; # required by v2rayA TProxy functionality path = with pkgs; [ iptables bash iproute2 ]; # required by v2rayA TProxy functionality
}; };
}; };
meta.maintainers = with maintainers; [ elliot ]; meta.maintainers = with maintainers; [ elliot ];