mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:19:22 +08:00
services.xray: fix
This commit is contained in:
@@ -53,7 +53,7 @@ inputs:
|
||||
snapper.enable = true;
|
||||
samba = { enable = true; hostsAllowed = "192.168. 127."; shares = { home.path = "/home"; root.path = "/"; }; };
|
||||
sshd = {};
|
||||
xray.client.dnsmasq.hosts."git.nas.chn.moe" = "127.0.0.1";
|
||||
xray.client = { enable = true; dnsmasq.hosts."git.nas.chn.moe" = "127.0.0.1"; };
|
||||
groupshare = {};
|
||||
smartd.enable = true;
|
||||
beesd.instances =
|
||||
|
||||
@@ -88,6 +88,7 @@ inputs:
|
||||
sshd = {};
|
||||
xray.client =
|
||||
{
|
||||
enable = true;
|
||||
dnsmasq.hosts = builtins.listToAttrs
|
||||
(
|
||||
(builtins.map
|
||||
|
||||
@@ -26,7 +26,7 @@ inputs:
|
||||
{
|
||||
# snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.client = {};
|
||||
xray.client.enable = true;
|
||||
fail2ban = {};
|
||||
wireguard =
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ inputs:
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.client = {};
|
||||
xray.client.enable = true;
|
||||
firewall.trustedInterfaces = [ "virbr0" ];
|
||||
wireguard =
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ inputs:
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = { passwordAuthentication = true; groupBanner = true; };
|
||||
xray.client = {};
|
||||
xray.client.enable = true;
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
smartd.enable = true;
|
||||
beesd.instances =
|
||||
|
||||
@@ -52,7 +52,7 @@ inputs:
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = { passwordAuthentication = true; groupBanner = true; };
|
||||
xray.client = {};
|
||||
xray.client.enable = true;
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
smartd.enable = true;
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 16384; threads = 4; };
|
||||
|
||||
@@ -9,7 +9,7 @@ inputs:
|
||||
behindNat = mkOption
|
||||
{
|
||||
type = types.bool;
|
||||
default = inputs.config.nixos.services.xray.client != null;
|
||||
default = inputs.config.nixos.services.xray.client.enable;
|
||||
};
|
||||
listenIp = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
|
||||
# if the host is behind xray, it should listen on another port, to make xray succeffully listen on 51820
|
||||
|
||||
@@ -2,32 +2,29 @@ inputs:
|
||||
{
|
||||
options.nixos.services.xray = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
client = mkOption
|
||||
client =
|
||||
{
|
||||
type = types.nullOr (types.submodule { options =
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
xray =
|
||||
{
|
||||
xray =
|
||||
serverAddress = mkOption { type = types.nonEmptyStr; default = "74.211.99.69"; };
|
||||
serverName = mkOption { type = types.nonEmptyStr; default = "vps6.xserver.chn.moe"; };
|
||||
};
|
||||
dnsmasq =
|
||||
{
|
||||
extraInterfaces = mkOption
|
||||
{
|
||||
serverAddress = mkOption { type = types.nonEmptyStr; default = "74.211.99.69"; };
|
||||
serverName = mkOption { type = types.nonEmptyStr; default = "vps6.xserver.chn.moe"; };
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
default = inputs.lib.optional inputs.config.nixos.virtualization.docker.enable "docker0";
|
||||
};
|
||||
dnsmasq =
|
||||
{
|
||||
extraInterfaces = mkOption
|
||||
{
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
default = inputs.lib.optional inputs.config.nixos.virtualization.docker.enable "docker0";
|
||||
};
|
||||
hosts = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
|
||||
};
|
||||
v2ray-forwarder =
|
||||
{
|
||||
noproxyUsers = mkOption { type = types.listOf types.nonEmptyStr; default = [ "gb" "xll" ]; };
|
||||
noproxyTcpPorts = mkOption { type = types.listOf types.ints.unsigned; default = []; };
|
||||
noproxyUdpPorts = mkOption { type = types.listOf types.ints.unsigned; default = []; };
|
||||
};
|
||||
};});
|
||||
default = null;
|
||||
hosts = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
|
||||
};
|
||||
v2ray-forwarder =
|
||||
{
|
||||
noproxyUsers = mkOption { type = types.listOf types.nonEmptyStr; default = [ "gb" "xll" ]; };
|
||||
noproxyTcpPorts = mkOption { type = types.listOf types.ints.unsigned; default = []; };
|
||||
noproxyUdpPorts = mkOption { type = types.listOf types.ints.unsigned; default = []; };
|
||||
};
|
||||
};
|
||||
server = mkOption
|
||||
{
|
||||
@@ -44,12 +41,12 @@ inputs:
|
||||
{
|
||||
assertions =
|
||||
[{
|
||||
assertion = !(xray.client != null && xray.server != null);
|
||||
assertion = !(xray.client.enable && xray.server != null);
|
||||
message = "Currenty xray.client and xray.server could not be simutaniusly enabled.";
|
||||
}];
|
||||
}
|
||||
(
|
||||
inputs.lib.mkIf (xray.client != null)
|
||||
inputs.lib.mkIf xray.client.enable
|
||||
{
|
||||
services =
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user