From fc4e95e2e0966d641e985117674af67d10237a6f Mon Sep 17 00:00:00 2001 From: c4710n Date: Sat, 12 Mar 2022 18:08:32 +0800 Subject: [PATCH] nixos/v2ray: change the type of `config` field Currently, the type of `config` is `types.attrsOf types.unspecified`. It results that the merging of list doesn't perform as expected. For example, I declare two part of config in two files: `a.nix`: ``` config = { routing = { rules = [ { type = "field"; outboundTag = "direct"; domain = [ "geosite:cn" ]; } ]; }; }; ``` `b.nix`: ``` config = { routing = { rules = [ { type = "field"; outboundTag = "direct"; ip = [ "geoip:cn" "geoip:private" ]; } ]; }; }; ``` After merging, only the content of `b.nix` left, the content of `a.nix` is removed. This commit give the right type of config, which makes the merging of config acts as expected. --- nixos/modules/services/networking/v2ray.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/v2ray.nix b/nixos/modules/services/networking/v2ray.nix index 95e8761ba5cc..6e7b480f55d5 100644 --- a/nixos/modules/services/networking/v2ray.nix +++ b/nixos/modules/services/networking/v2ray.nix @@ -2,7 +2,9 @@ with lib; -{ +let + json = pkgs.formats.json { }; +in { options = { services.v2ray = { @@ -39,7 +41,7 @@ with lib; }; config = mkOption { - type = types.nullOr (types.attrsOf types.unspecified); + type = types.nullOr json.type; default = null; example = { inbounds = [{