11 cfg = config.services.v2raya;
17 enable = options.mkEnableOption "the v2rayA service";
19 package = options.mkPackageOption pkgs "v2raya" { };
20 cliPackage = options.mkPackageOption pkgs "v2ray" {
21 example = "pkgs.xray";
22 extraDescription = "This is the package used for overriding the value of the `v2ray` attribute in the package set by `services.v2raya.package`.";
27 config = mkIf config.services.v2raya.enable {
28 environment.systemPackages = [ (cfg.package.override { v2ray = cfg.cliPackage; }) ];
30 systemd.services.v2raya =
32 nftablesEnabled = config.networking.nftables.enable;
35 ] ++ optional config.networking.enableIPv6 "ip6tables.service";
36 tableServices = if nftablesEnabled then [ "nftables.service" ] else iptablesServices;
40 Description = "v2rayA service";
41 Documentation = "https://github.com/v2rayA/v2rayA/wiki";
46 Wants = [ "network.target" ];
51 ExecStart = "${getExe (cfg.package.override { v2ray = cfg.cliPackage; })} --log-disable-timestamp";
52 Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ];
54 LimitNOFILE = 1000000;
55 Restart = "on-failure";
59 wantedBy = [ "multi-user.target" ];
67 ++ lib.optionals nftablesEnabled [ nftables ]; # required by v2rayA TProxy functionality
71 meta.maintainers = with maintainers; [ elliot ];