diff --git a/nixos/modules/services/networking/v2raya.nix b/nixos/modules/services/networking/v2raya.nix index aefb47bf048d..556258a2a050 100644 --- a/nixos/modules/services/networking/v2raya.nix +++ b/nixos/modules/services/networking/v2raya.nix @@ -2,15 +2,25 @@ with lib; +let + cfg = config.services.v2raya; +in + { options = { services.v2raya = { enable = options.mkEnableOption "the v2rayA service"; + + package = options.mkPackageOption pkgs "v2raya" { }; + cliPackage = options.mkPackageOption pkgs "v2ray" { + example = "pkgs.xray"; + extraDescription = "This is the package used for overriding the value of the `v2ray` attribute in the package set by `services.v2raya.package`."; + }; }; }; config = mkIf config.services.v2raya.enable { - environment.systemPackages = [ pkgs.v2raya ]; + environment.systemPackages = [ (cfg.package.override { v2ray = cfg.cliPackage; }) ]; systemd.services.v2raya = let @@ -33,7 +43,7 @@ with lib; serviceConfig = { User = "root"; - ExecStart = "${getExe pkgs.v2raya} --log-disable-timestamp"; + ExecStart = "${getExe (cfg.package.override { v2ray = cfg.cliPackage; })} --log-disable-timestamp"; Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ]; LimitNPROC = 500; LimitNOFILE = 1000000; @@ -48,3 +58,4 @@ with lib; meta.maintainers = with maintainers; [ elliot ]; } +