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.
This commit is contained in:
c4710n
2022-03-12 18:08:32 +08:00
parent 02177737c5
commit fc4e95e2e0
+4 -2
View File
@@ -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 = [{