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:
@@ -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 = [{
|
||||
|
||||
Reference in New Issue
Block a user